D.gnu - Problem with multi-dimensional associative arrays?
- Brian Palmer (7/7) Apr 26 2007 This code works with DMD 1.010 for Windows, but fails with an ArrayBound...
- Carlos Santander (6/16) Apr 26 2007 Try inserting this between those two lines:
- Brian Palmer (4/13) Apr 26 2007 That worked, thank you! I was trying things like
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)
Apr 26 2007
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
Apr 26 2007
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 BernalThat 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.
Apr 26 2007