Hello,
I'm playing around with the SetLength function und I wonder why the
following little test app works:
{01} program setlengthtest;
{02} var strarray:array of string;
{03} i:word;
{04}
{05} begin
{06} setlength(strarray,2);
{07} strarray[0]:='1. String';
{08} strarray[1]:='2. String';
{09} strarray[2]:='3. String';
{10} strarray[3]:='4. String';
{11} strarray[4]:='5. String';
{12} for i:=0 to 4 do writeln(strarray[i]);
{13} end.
To my understanding there should be an error in line 9, because the
array index is exceeded.
If I compile this little app on MacOS X 10.4.8 with FPC 2.1.1 it seems
to work just fine. So how to set a strict boundary of a dynamic array?
Any ideas?
Thanks in advance,
Dennis Schramm