safety: null checks

Johan Engelen j at j.nl
Mon Nov 23 16:50:44 UTC 2020


On Monday, 23 November 2020 at 12:03:49 UTC, Paul Backus wrote:
> On Monday, 23 November 2020 at 12:01:08 UTC, Johan Engelen 
> wrote:
>>
>> I'll reiterate what I've been saying many times already: in 
>> LDC, null dereference in Undefined Behavior. What follows is 
>> that code should _actively_ check for null to be safe. 
>> Checking for null is not included by the compiler in @safe 
>> code.
>
> Then LDC allows memory corruption in @safe code,

Correct. And so do all other D compilers. Completely independent 
of optimization level.

> which is a bug.

Without explicit null pointer checking, this is effectively a 
"won't fix".

-Johan



More information about the Digitalmars-d mailing list