compiler errors - Why does an indefinite aggregate slide but a definite one does not? -
this 1 of academic things i'd understand better. (i have no justification why 1 write code this.)
if have code starts indefinite type like
type indef array (integer range <>) of integer; my_indef : indef (1..2) := (3=>0, 4=>0);
this compile , aggregate slide; range 1..2
if instead start definite type
type def array (1..2) of integer; my_def : def := (3=>0, 4=>0);
this not compile without warning, nor run without runtime error. don't see why first sample slide second not.
your second example wrong. def
definite array type, can't specify/change constraints when declare object of type.
if try:
type def array (1..2) of integer; my_def : def := (3 => 0, 4 => 0);
it compile, fail @ runtime, not because can't slide, because initial constraints out of range.
to see array sliding work definite array type, try:
j_def : def := (2 => 2) & (2 => 1);
Comments
Post a Comment