Using "[]" for empty array (instead of null)

Anders F Björklund afb at algonet.se
Wed Mar 1 01:48:44 PST 2006


Lionello Lunesu wrote:

> Subject says it all, what do you think?
> 
> I always found the "char[] ar = null;" suspicious. An array is not (just) a 
> pointer. What happens with its length?

Sounds OK, but doesn't it require (the long-lost) array literals first ?

void main()
{
   char ar[] = [];
}

variable test.main.ar is not a static and cannot have static initializer

--anders



More information about the Digitalmars-d mailing list