How to check whether an empty array variable is null?

tcak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Oct 10 08:20:02 PDT 2015


[code]
	int[] list;

	list = new int[0];

	std.stdio.writeln("Is Null ? ", (list is null));
[/code]

Result is "Is Null? true".

Is this the correct behaviour? I would expect compiler to point 
to an address in the heap, but set the length as 0. So, it 
wouldn't return null, but the length would be 0 only.


More information about the Digitalmars-d-learn mailing list