digitalmars.D - Re: .init property for char[] type
- bearophile <bearophileHUGS lycos.com> Sep 23 2009
Andrei Alexandrescu:Justin Johansson (I think):short.init 0 int.init 0 bool.init false byte.init 0 double.init double.nan long.init 0L
You forgot char.init 0xFF wchar.init 0xFFFF dchar.init 0xFFFFFFFF
One small disadvantage of some of those init values (for not int variables) is that if you have a large global static array of floats or chars in your program, its memory can be found in the binary, that can become huge (you can avoid that setting the static array to void, and then I think the LDC compiler or the operating system resets such memory to zero anyway). To avoid such huge binaries D can keep small static arrays like now, but it can initialize at run-time (before the main) the large static arrays. Bye, bearophile
Sep 23 2009