[fpc-devel] An extension of fpc language: the BASED construct

Mark Morgan Lloyd markMLl.fpc-devel at telemetry.co.uk
Tue Dec 26 14:27:12 CET 2017

On 26/12/17 12:45, Giuliano Colla wrote:

> /In short the BASED construct makes the C-style dereferencing operator 
> unnecessary, by moving dereferencing from code to declaration.
> In fpc this translates into code looking like this, in this trivial example:
> var
>    I: BYTE;
>    I1: INTEGER;
>    ItemPtr: Pointer;
>    Item: BYTE BASED ItemPtr;
>    IntegerItem: INTEGER BASED ItemPtr;
> ....
>    ItemPtr := @I;
>    Item := $41;
> ....
>    ItemPtr := @I1;
>    IntegerItem := -32767;
> This code will load the BYTE value $41 into the variable I, and the 
> INTEGER value -32767 into the variable I1.

What does gdb (and possibly other debuggers) make of this? Is it really 
appropriate to declare Item as a variable, when it's really more akin to 
a macro?

Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]

More information about the fpc-devel mailing list