[fpc-pascal] Re: type definitions etc

listmember listmember at letterboxes.org
Sun May 29 09:50:03 CEST 2005


Jeff Pohlmeyer wrote:
> To clarify, you can actually have many additional types between
> the pointer type and the record definition, as long as you
> don't introduce another section keyword that "turns off"
> the current "type" section. 
> 
> For instance, this will work:
> 
>   type
> 
>     pMyRec = ^tMyRec; // forward declaration
> 
>     MyInt = integer;
>     MyArray = array[0..255] of char;
> 
>     { Hundreds more typedef's could go here }
> 
>     tMyRec = Record // actual definition
>       data:pointer;
>       next:pMyRec;
>     end;
> 
> 
> But the next example will NOT work, because the 
> additional "type" keyword separates the two types:
> 
>   type  pMyRec = ^tMyRec;
>   type  tMyRec = Record
>       data:pointer;
>       next:pMyRec;
>     end;

I can see what you mean, but I fail see the wisdom
behind the restriction.

Why should it matter if we used 2 'type' keywords
instead of one --we are, after all, in the same
declaration sestion of the same unit... Why should
it matter?

Cheers,
Ray




More information about the fpc-pascal mailing list