Null references and access violation
pineapple via Digitalmars-d
digitalmars-d at puremagic.com
Wed Sep 14 12:33:40 PDT 2016
On Wednesday, 14 September 2016 at 18:36:46 UTC, Jonathan M Davis
wrote:
> If you don't want to have problems with dereferencing null
> pointers or references, then check for null in the cases where
> a pointer or reference might be null.
>
> - Jonathan M Davis
Writing your functions that disallow null inputs like `fn(int*
arg) in{assert(arg !is null);} body{ ... }` is readable, concise,
and in my opinion a generally elegant solution to the problem.
More information about the Digitalmars-d
mailing list