[fpc-pascal]About ansistrings.

FPC Mail list reader fpc at cdp.cugir.com
Sun Dec 31 00:40:07 CET 2000


Hi. I'm doing some stuff in which i declare a record-type which
contains an ansistring. When i try to allocate a variable of that type, i
get a General Protection Fault. Here's the source code :

---||cut here||---------------------
type TStuff=record
            s:ansiestring;
           end;
     Pstuff=^Tstuff;
var stuff:array[1..10] of Pstuff;
    idx:word;
begin
 idx:=1;
 new(stuff[idx]);
end.
---||stop cutting||-----------------

Under Go32 it seems to work, but it crashes under Win32 & Linux.

I've noticed that if i replace "new(stuff[idx])" with "new(stuff[1])" it
works. And Delphi doesn't seem to have any problem with any of the 2 calls
to new().

Is there any obvious solution for this ?

Thanx for reading till here,

               Bogdan.





More information about the fpc-pascal mailing list