[pascal]Originally Posted by JSoftware
var a,b:array of byte;
begin
setlength(a,1);
a[0]:=1;
b:=a;
b[0]:=2;
writeln(a[0]);
end;
[/pascal]
A and b are basically pointers to arrays, but because they don't use a pointer syntax, the above result is unexpected for many.
[pascal]
procedure a(const b:array of byte);
begin
end;
begin
a([1,2,3,4]); {Set constant or array constant?}
end;
[/pascal]
Now in this example things are pretty clear, but if procedure a is in a different unit, it is not clear what that constant means.
Bookmarks