【发布时间】:2022-02-03 13:49:33
【问题描述】:
在这个Intro to Ada Course section about Arrays 中,它表明我可以使用用户定义的类型“Index”来索引一个数组,但是当我尝试使用用户定义的类型来索引一个数组时,它会显示预期的类型“Standard.Integer”。我问这个的原因是因为它明确指出您可以使用任何离散类型来索引数组。
procedure Cipher is
type Byte is mod 2**8;
type BufferArray is array ( 0 .. 15 ) of Byte;
type Index is range 1 .. 16;
Buffer: BufferArray := (0, 0, 100, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
buber: Byte := 255;
begin
-- Insert code here.
for I in Index loop
Put( Byte'Image(Buffer(I)) ); --error shows up here
end loop;
null;
end Cipher;
这个特定版本的 GNAT 是否有问题?
【问题讨论】: