[fpc-devel] type pointer to record before record.

Skybuck Flying skybuck2000 at hotmail.com
Fri Apr 29 20:02:04 CEST 2011


----- Original Message ----- 
From: "Florian Klaempfl" <florian at freepascal.org>
To: "FPC developers' list" <fpc-devel at lists.freepascal.org>
Sent: Friday, 29 April, 2011 15:57 PM
Subject: Re: [fpc-devel] type pointer to record before record.


> Am 29.04.2011 15:51, schrieb Flávio Etrusco:
>>> type
>>>   TMyRecord = record
>>>       mPrev : ^TMyRecord; // not allowed.
>>>   end;
>>
>> Marco, only if you happen to know from the top of your head, would it
>> be possible and without consequences to allow this kind of
>> construction? (i.e. a pointer reference to itself)
>
> No. Because TMyRecord could be already defined in another unit.

Unit1.TMyRecord
Unit2.TMyRecord

is allowed as long as both units do not reference each other.

In case one of the two units reference each other there would probably be an 
error message that TMyRecord is already declared and that there is a 
conflict.

Therefore this error situation that you fabricated is already caught by the 
compilers at least I know Delphi will.

Perhaps you are referring to a problem inside the compiler in relation with 
the symbol table, in that case an easy fix would be to apply:

Unit1.TMyRecord, Unit2.TMyRecord so place unit name in front of symbol, but 
this is probably already done since this is legal as long as they not 
referencing each other.

Bye,
  Skybuck. 




More information about the fpc-devel mailing list