We all get nullability wrong sometimes

Walter Bright newshound2 at digitalmars.com
Thu Jul 9 23:09:31 UTC 2026


A simpler version of that is:

```d
void foo(int* p)
{
     if (p == null)
         *p = 3;
}
```
which I keep thinking I should implement in the optimizer.

```
void foo()
{
     int* p = null;
     *p = 3;
}
```
already yields from the compiler:

```
Error: null dereference in function _D5test23fooFZv
```
when compiled with -O


More information about the Digitalmars-d mailing list