[fpc-pascal]The compiler messes up some pointers.
yendor at nic.fi
yendor at nic.fi
Sat Sep 22 18:55:30 CEST 2001
I have a problem where FPC modifies a pointer without me instructing it
to do so.
With stucture :
Type
PAnsiString = ^AnsiString;
PPAnsiString = ^PAnsiString;
Var
RowAP : ^PPAnsiString;
I first create two rows (that are the ansistrings in a pointer of array of
pointer of ansistring structure) and set some data into them. After that I
add one row between these two and initialize it with exactly these rows :
GetMem(RowAP^[1], SizeOf(AnsiString));
Writeln(LongInt(RowAP^[2]));
RowAP^[1]^ := 'a';
Writeln(LongInt(RowAP^[2]));
The program outputs two lines that are : "4284808" and "4284807" (the
values differ of course, but not the difference) which isn't right. I can't
reproduce this in other programs (haven't tried very extensively) but I
don't think that I could ever mess up my program to produce this kind of
thing.
If you want, I can send you the full source code of my program if
requested.
- Eero Tanskanen
________________________________________________________________
Ilmainen Internet @ http://www.nic.fi/
More information about the fpc-pascal
mailing list