tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: NULL pointer arithmetic issues

On 24.02.2020 21:18, Mouse wrote:
>>> If we use 0x0, it can be a valid pointer.
>>> If we use NULL, it's not expected to work and will eventually
>>> generate a syntax erro.
> Then someone has severely broken compatability with older versions of
> C.  0x0 and (when one of the suitable #includes has been done) NULL
> have both historically been perfectly good null pointer constants.
> Also...syntax error?  Really?  _Syntax_ error??  I'd really like to see
> what they've done to the grammar to lead to that; I'm having trouble
> imagining how that would be done.

The process of evaluation of the NULL semantics is not a recent thing.

Not so long time, still in the NetBSD times, it was a general practice
to allow dereferencing the NULL pointer and expect zeroed bytes over there.

We still maintain compatibility with this behavior (originated as a hack
in PDP11) in older NetBSD releases (NetBSD-0.9 Franz Lisp binaries
depend on this).

> /~\ The ASCII				  Mouse
> \ / Ribbon Campaign
>  X  Against HTML
> / \ Email!	     7D C8 61 52 5D E7 2D 39  4E F1 31 3E E8 B3 27 4B

Attachment: signature.asc
Description: OpenPGP digital signature

Home | Main Index | Thread Index | Old Index