[fpc-pascal] NULL pointer to array of integer
Vinzent Höfler
JeLlyFish.software at gmx.net
Wed Sep 13 19:39:07 CEST 2006
Jonas Maebe wrote:
> On 13 Sep 2006, at 14:00, Eduardo wrote:
>
>> I remember that on c a null pointer has value 0, but in ansi pascal it
>> has value 23.
>
> The value of nil is not defined in the ISO Ansi Pascal standard.
Neither it is in any official C standard.
> In FPC, nil = pointer(0) on all currently supported platforms, but in
> principle it could be anything.
I'm making enemies now, but:
If the NIL pointer is represented by another value (like 0xFFFFF780 or
such) on a given target platform, the integer conversion from a
_compile-time_ constant 0 literal should still lead to a NIL representation.
Basically that would be the same behaviour as what the C-standard
guarantees.
Note that this leads to a subtle difference on such platforms between
integer literals whether they're known at compile or at runtime.
Vinzent.
More information about the fpc-pascal
mailing list