Thread overview | |||||
---|---|---|---|---|---|
|
April 26, 2007 Problem with multi-dimensional associative arrays? | ||||
---|---|---|---|---|
| ||||
This code works with DMD 1.010 for Windows, but fails with an ArrayBoundsError on gdc 0.23, using dmd 1.007 void main() { int stuff[char[]][char[]]; stuff["brian"]["pocket"] = 3; } It appears that GDC doesn't know how to handle multi-dimensional AAs. (My environment: i686-apple-darwin8-gdc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5363) (gdc 0.23, using dmd 1.007), I'm using a pre-compiled binary of GDC downloaded from http://sourceforge.net/projects/gdcmac) |
April 26, 2007 Re: Problem with multi-dimensional associative arrays? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Brian Palmer | Brian Palmer escribió: > This code works with DMD 1.010 for Windows, but fails with an ArrayBoundsError on gdc 0.23, using dmd 1.007 > > void main() { > int stuff[char[]][char[]]; > stuff["brian"]["pocket"] = 3; > } > > It appears that GDC doesn't know how to handle multi-dimensional AAs. > > (My environment: i686-apple-darwin8-gdc-4.0.1 (GCC) 4.0.1 (Apple Computer, Inc. build 5363) (gdc 0.23, using dmd 1.007), I'm using a pre-compiled binary of GDC downloaded from http://sourceforge.net/projects/gdcmac) Try inserting this between those two lines: stuff["brian"] = null; I haven't tested it, but that's how I've always got stuff like that to work. -- Carlos Santander Bernal |
April 26, 2007 Re: Problem with multi-dimensional associative arrays? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Carlos Santander | Carlos Santander Wrote:
>
> Try inserting this between those two lines:
>
> stuff["brian"] = null;
>
> I haven't tested it, but that's how I've always got stuff like that to work.
>
> --
> Carlos Santander Bernal
That worked, thank you! I was trying things like
stuff["brian"] = new int[char[]];
which doesn't compile, I don't know why I didn't think of just setting it to null. Since my original example works with DMD on Windows, though, I think I better still file a bug report.
|
Copyright © 1999-2021 by the D Language Foundation