[fpc-pascal] Re: type definitions etc

Jeff Pohlmeyer yetanothergeek at gmail.com
Sun May 29 07:49:13 CEST 2005

> > OK, I didn't try that, so it is allowed to define a type
> > as a pointer to a type that is defined later.

> Yes, but _only_ if the type declaration comes _immediately_ after
> the pointer type declaration. So you can't just declare a bunch 
> of pointer types and defer the actual type-declaration to a later 
> point, that won't work.

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:


    pMyRec = ^tMyRec; // forward declaration

    MyInt = integer;
    MyArray = array[0..255] of char;

    { Hundreds more typedef's could go here }

    tMyRec = Record // actual definition

But the next example will NOT work, because the 
additional "type" keyword separates the two types:

  type  pMyRec = ^tMyRec;
  type  tMyRec = Record

More information about the fpc-pascal mailing list