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]
_______________________________________________
fpc-devel maillist  -  fpc-devel@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-devel

Reply via email to