Very simple null reference escape

Basile B. b2.temp at gmx.com
Sun Jun 2 20:06:17 UTC 2019


On Sunday, 2 June 2019 at 07:55:27 UTC, Amex wrote:
> A.B
>
> If A is null, crash.
>
> A?.B : writeln("HAHA");
>
> No crash, ignored, equivalent to
>
> if (A is null) writeln("HAHA"); else A.B;

safeAccess from iz does this : 
https://github.com/Basile-z/iz/blob/master/import/iz/sugar.d#L1666


More information about the Digitalmars-d-learn mailing list