[std.c.stdlib] (malloc(something) is null) or (malloc(something) == 0)?
bearophile via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Tue May 20 07:05:13 PDT 2014
Alexandr Druzhinin:
> In D code I do
> void* data = GC.malloc(...);
> if(data is null)
> ...
>
> In C code I do
> void* data = malloc(...);
> if(data == null)
> ...
>
> What to do when in D code I have
> void* data = std.c.stdlib.malloc(...);
> if(data ?) // is null vs == 0
"x is null" or "x == null" are the same operation when x is a raw
pointer.
Bye,
bearophile
More information about the Digitalmars-d-learn
mailing list