safety: null checks
Patrick Schluter
Patrick.Schluter at bbox.fr
Mon Nov 23 20:00:29 UTC 2020
On Monday, 23 November 2020 at 12:39:05 UTC, Ola Fosheim Grøstad
wrote:
> On Monday, 23 November 2020 at 12:28:39 UTC, Patrick Schluter
> wrote:
>> No. null is not a trap representation as a C standard would
>> call it. It is a valid value for a pointer. Dereferencing it
>> is an entirely other thing.
>
> A trap is an interrupt at the hardware level. It has nothing to
> do with C.
Read the C standard, they explain what a trap representation is.
It has nothing to do with an interrupt. I refer to the C standard
because they make the difference between allowed pointer values
and unallowed values even if never dereferenced.
Read the selected answer on this stackoverflow [1] page, he
explains it better than me.
[1]:
https://stackoverflow.com/questions/6725809/trap-representation
More information about the Digitalmars-d
mailing list