[fpc-pascal]Bug with a record type?

Peter Vreman peter at freepascal.org
Tue Feb 20 09:21:44 CET 2001


> 
> Hansi, Johan;
> 
> > You declared DataFromFile as a record of Pointers (^DataRecord),
> > but you try to access it as it was an array of record. Write the
> > above line as: if DataFromFile [CurrentLine]^.Display then so i
> > should work.
> 
> > I don't know anything about VP, so I dont' understand why it
> > compiles this except if you made a typemistake in the code above,
> > but you are declaring an array of POINTERS to DataRecord, not of
> > the records themself. So you have to use
> > DataFromFile[CurrentLine]^.Display;
> 
> You're both correct -- I was looking right past that. It's even more
> amazing that VP compiled and ran the program just fine using the exact same
> source (and no, there wasn't any typing mistake -- I used cut and paste to
> take the code directly from the source file itself). Perhaps I should be
> sending an email to Allan at VP now...  :-)

VP is delphi like and has automatic pointer dereferencing so you don't need the ^ anymore.
This is against the strict pascal rules so we don't support it in the fpc modes. Try the
to compile with -Sd that is more Delphi/VP compatible.







More information about the fpc-pascal mailing list