【发布时间】:2014-10-03 01:06:12
【问题描述】:
我是 Ada 的新手,我正在尝试创建一个记录数组,然后将一些记录放入数组中,但我收到错误 nested array aggregate expected。这是我的代码:
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;
【问题讨论】:
-
您将
Image声明为二维像素数组,然后为其分配一维像素数组。这三个像素代表什么?顶行左侧或最左侧列顶部的三个像素?
标签: ada