我是新来的Ada,我试图创建一个记录数组,然后把一些记录放到数组中,但是我得到错误nested array aggregate expected
。这是我的代码:Ada编程数组记录
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Integer_Text_Io;
with Ada.unchecked_conversion;
procedure main is
type Byte is range 0..255;
for Byte'Size use 8;
type Pixel is record
R:Byte;
G:Byte;
B:Byte;
end record;
for Pixel'Size use 24;
r1:Pixel := (1,2,5);
r2:Pixel := (1,2,3);
r3:Pixel := (1,2,3);
type Image is array(Positive range <>, Positive range <>) of Pixel;
Pragma Pack(Image);
Left:Image(1..3, 1..1) := (r1, r2, r3);
begin
null;
end main;
你声明'图像“作为像素的二维阵列,但是然后为其分配一维像素阵列。这三个像素代表什么?顶部行左边的三个像素还是最左边一列的顶部? – 2014-10-02 14:58:57