safety: null checks
Dibyendu Majumdar
mobile at majumdar.org.uk
Sun Nov 22 22:16:11 UTC 2020
On Sunday, 22 November 2020 at 15:25:48 UTC, Q. Schroll wrote:
> On Sunday, 22 November 2020 at 11:52:13 UTC, Dibyendu Majumdar
> wrote:
>> Above fails because b is null. But why doesn't the compiler
>> say so? It seems like a very basic safety check.
>
> Nullpointer exceptions aren't a safety issue since the program
> crashes. For it to be a safety issue, it would need to have
> "bad consequences" e.g. writes to memory at locations the
> program isn't supposed to.
Right. A crash isn't a bad consequence, of course.
More information about the Digitalmars-d
mailing list