[fpc-pascal] Translate C code

Karoly Balogh (Charlie/SGR) charlie at scenergy.dfmk.hu
Sat Jan 6 11:25:03 CET 2018


Hi,

On Sat, 6 Jan 2018, Ryan Joseph wrote:

> Also why does @(PMyStruct(nil)^.next not crash? Dereferencing and taking
> the addressing of a nil pointer sounds like a bad idea.

Because it doesn't do the actual dereferencing, because next's *VALUE* is
never used, only it's address (due to the @ operator). Which is basically
a fixed address of zero (nil) + a constant added together.

So it doesn't crash, because it never loads from this "invalid" address it
calculates.

Charlie



More information about the fpc-pascal mailing list