So many years I was following D...

Gide Nwawudu gide at btinternet.com
Wed Oct 14 04:58:28 PDT 2009


On Wed, 14 Oct 2009 04:26:38 -0400, Iamgottingcrazy
<shouldIlearnthis at digitalmars.com> wrote:

>Should I bear this??
>
>module teststructarray;
>
>import std.stdio;
>import core.stdc.stdlib:system;
>
>struct Point
>{
>  int x;
>  int y;
>}
>static Point[2] pArray1=
>[
>  {0,0},{0,1},//watch here!
>];
>
>static Point pArray2[2][3]=
>[
>  [{0,0},{0,1},{0,2}],
>  [{1,0},{1,1},{1,2}],//watch here,without the last comma,the prog can't get compiled!!
>];
>void main()
>{
>  foreach(int i,point;pArray1)
>    writefln("Point(%d)={%d,%d}",i,pArray1[i].x,pArray1[i].y);
>  
>  foreach(points;pArray2)
>  {
>    foreach(point;points)
>    {
>      writef("Point(%d,%d)\t",point.x,point.y);
>    }
>    write("\n");
>  }
>  system("pause");//watch when this line gets executed
>}
>
>Try compile and run.

Looks like a version of the following bug.

http://d.puremagic.com/issues/show_bug.cgi?id=2477

Gide



More information about the Digitalmars-d mailing list