Andrei Alexandrescu Wrote: > Justin Johansson wrote: > > Jeremie Pelletier Wrote: > >> Besides, if you initialize character > >> arrays to "", what do you initialize other arrays to, and other > >> reference types to? It just wouldn't be consistent. > > > > Consistency. Since when is that an argument? > > > > Just to be a PITA, pick the inconsistent row in the table below (from > > spec_D1.00.pdf). > > The row ordering of the the table has been shuffled just to make it a bit > > more difficult to spot :-) > > > > 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 > > > Andrei
Shhh; don't tell anybody; I left those out of the quiz to weigh in favour of zero bit pattern init values. (This trick, i.e. omitting information, is one I learned from the Ministries of Statistics and (un)Employment.) Seriously though, I imagine the D design choices to be influenced by the desire to propagate NaN and invalid UTF in their respective cases so as to detect uninitialized data errors. Hmm, guess one could argue the init issue for eons. -- Justin
