digitalmars.D.bugs - [Regression] Misplaced initialisers in static rectangular array
- Stewart Gordon (34/34) Jun 14 2005 Using DMD 0.126, Windows 98SE.
- Walter (1/1) Jun 16 2005 It's valid D, and a compiler bug.
- Thomas Kuehne (13/40) Jun 18 2005 -----BEGIN PGP SIGNED MESSAGE-----
Using DMD 0.126, Windows 98SE. The spec contradicts itself on whether this is valid D. But whether it is or not, it certainly shouldn't be doing what it's doing. Which seems to be skipping only one byte instead of three for the uninitialised elements. ---------- import std.stdio; const char[3][13] month = [ 1: "Jan", "Feb", "Mar", "Apr", "May", "Jun", 8: "Aug", "Sep", "Oct", "Nov", "Dec" ]; void main() { writefln(month[1]); writefln(month[2]); writefln(month[5]); writefln(month[7]); writefln(month[8]); writefln(month[6]); } ---------- nFe bMa yJu ugS epO nError: 4invalid UTF-8 sequence ---------- My vote goes to the sentence "If any members of an array are initialized, they all must be." being the correct one, in which case this should be a compile error. Stewart. -- My e-mail is valid but not my primary mailbox. Please keep replies on the 'group where everyone may benefit.
Jun 14 2005
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Stewart Gordon schrieb am Tue, 14 Jun 2005 10:26:20 +0100:Using DMD 0.126, Windows 98SE. The spec contradicts itself on whether this is valid D. But whether it is or not, it certainly shouldn't be doing what it's doing. Which seems to be skipping only one byte instead of three for the uninitialised elements. ---------- import std.stdio; const char[3][13] month = [ 1: "Jan", "Feb", "Mar", "Apr", "May", "Jun", 8: "Aug", "Sep", "Oct", "Nov", "Dec" ]; void main() { writefln(month[1]); writefln(month[2]); writefln(month[5]); writefln(month[7]); writefln(month[8]); writefln(month[6]); } ---------- nFe bMa yJu ugS epO nError: 4invalid UTF-8 sequence ----------Added to DStress as http://dstress.kuehne.cn/run/a/array_initialization_17_A.d http://dstress.kuehne.cn/run/a/array_initialization_17_B.d http://dstress.kuehne.cn/run/a/array_initialization_17_C.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCs9t33w+/yD4P9tIRAlMnAKCiGiYGayK+S0uHDNUq9UrAkVRDJgCfU1ac ksQxWinc8EYlVsq1/bPC420= =dbnV -----END PGP SIGNATURE-----
Jun 18 2005