[std.c.stdlib] (malloc(something) is null) or (malloc(something) == 0)?

Alexandr Druzhinin via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Tue May 20 07:03:01 PDT 2014


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


More information about the Digitalmars-d-learn mailing list