Biggest problems w/ D - strings

C. Dunn cdunn2001 at gmail.com
Tue Aug 14 18:03:25 PDT 2007


Chris Nicholson-Sauls Wrote:
> >> Ever since Issue 1268 was fixed in 1.017, you can just write:
> >> char[32] abc = 0;
> > I always wished that that were possible, but never knew if it was legal :D 
> Oh it is, but there's no equivelant one-liner for dynamic arrays.  Instead you have to:
> 
> auto var = new int[len];
> var[] = 42;

If I cannot tell the "new int[]" expression what the initializer should be, then I would rather it not initialize at all.  In the case above, it initializes twice!



More information about the Digitalmars-d mailing list