digitalmars.D - So many years I was following D...
- Iamgottingcrazy (34/34) Oct 14 2009 Should I bear this??
- bearophile (5/6) Oct 14 2009 With D1 it seems to work:
- Fawzi Mohamed (5/14) Oct 14 2009 maybe because you actually used the correct sequence of dimensions...
- AJ (2/8) Oct 16 2009 He had a technical problem and worded his subject line that way?
- Gide Nwawudu (5/39) Oct 14 2009 Looks like a version of the following bug.
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.
Oct 14 2009
Iamgottingcrazy:Should I bear this??With D1 it seems to work: http://codepad.org/hpslrHHs Bye, bearophile
Oct 14 2009
On 2009-10-14 10:48:10 +0200, bearophile <bearophileHUGS lycos.com> said:Iamgottingcrazy:maybe because you actually used the correct sequence of dimensions... int[2][3] x; x.length is 3, this is a 3 dimensional array of 2 dimensional arrays... FawziShould I bear this??With D1 it seems to work: http://codepad.org/hpslrHHs Bye, bearophile
Oct 14 2009
bearophile wrote:Iamgottingcrazy:He had a technical problem and worded his subject line that way?Should I bear this??With D1 it seems to work: http://codepad.org/hpslrHHs Bye, bearophile
Oct 16 2009
On Wed, 14 Oct 2009 04:26:38 -0400, Iamgottingcrazy <shouldIlearnthis 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
Oct 14 2009