[fpc-pascal] Illogical automatic dereferencing

Marco van de Voort marcov at stack.nl
Sat Oct 10 15:32:59 CEST 2009


In our previous episode, Henry Vermaak said:
> >
> > That link is talking about interchangability, which is not the same as being
> > the same.
> 
> Yes, I'm just trying to explain that there's no magic to it,
> illustrated by some basic pointer arithmetic.

I think there are several bits that mix in this thread:

1 nearly all types that don't fit in registers are in memory, and you need
   a memory access to reference them. This makes them all
  references/pointers/addresses on assembler level, but not necessary pointers
  on language level.
2 The fact that Delphi mandatory skips a ^ when indexing a pointer + array.
3 The fact that FPC allows both in objfpc mode. (which means)
4 The fact that FPC and Delphi allow pchar to be overindexed.
5 The fact that FPC and Delphi 2009+ with {$pointermath on} also allow it
    for other pointer types.

Note that I write this from memory after porting some FPC bits to Delphi
last week. Most notably the {$pointermath on} (5) and the mandatory aspect
of (2) might be related.



More information about the fpc-pascal mailing list