[fpc-pascal] record helpers & how they effect records

Michael Van Canneyt michael at freepascal.org
Tue Jun 9 07:20:58 CEST 2015



On Mon, 8 Jun 2015, David Emerson wrote:

> using a simple record, e.g.
>
> some_record_type = record
>  a, b : longint;
>  end;
>
> If I declare a record helper, does this change the record in any way? i.e. 
> does the record take any more space when passed as a function parameter? Does 
> it become somehow like an object, and need to be allocated?

No. It remains a record.

> Or is the helper 
> more like a language shortcut/convenience, where the compiler still treats 
> the record the same way, and declaring and using the helper is equivalent to 
> declaring and using a function that takes the record as a parameter?

Yes, this is correct. It's syntactical sugar. The basic layout of a record is not changed.

Michael.



More information about the fpc-pascal mailing list