www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - Static array initialization bug.

reply "Andrew Fedoniouk" <news terrainformatica.com> writes:
<quote src="D doc">
"Static array contents are initialized to the default initializer for the 
array element type."
</quote>

typedef int Type = 12;
static Type[2] var = [0:1];

int main(char[][] args)
{
  assert(var[0] == 1);
  assert(var[1] == 12); // <- assert is here
}

I am getting assertion on marked line, any advices how to solve ths? 
Apr 12 2005
parent Thomas Kuehne <thomas-dloop kuehne.thisisspam.cn> writes:
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Andrew Fedoniouk schrieb am Tue, 12 Apr 2005 16:00:08 -0700:
<quote src="D doc">
 "Static array contents are initialized to the default initializer for the 
 array element type."
</quote>

 typedef int Type = 12;
 static Type[2] var = [0:1];

 int main(char[][] args)
 {
   assert(var[0] == 1);
   assert(var[1] == 12); // <- assert is here
 }

 I am getting assertion on marked line, any advices how to solve ths? 
Added to DStress as http://dstress.kuehne.cn/run/array_initialization_06.d http://dstress.kuehne.cn/run/array_initialization_07.d Thomas -----BEGIN PGP SIGNATURE----- iD8DBQFCXxwH3w+/yD4P9tIRAqnGAJ9q3e/6B61PZftrGHzxuTOon44dswCfSRbb qky2riASw7KRVi1aRdEC41Q= =2xNb -----END PGP SIGNATURE-----
Apr 14 2005