noob Q: array out-of-range
Duke Normandin
dukeofperl at ml1.net
Fri May 28 12:53:39 PDT 2010
Hey...
Compiler is now working as expected! Thank's to a great catch by
Michel Fortin!
A little further down the tutorial "D_ A Newbie-Oriented Tutorial",
there's this code:
[code]
import std.stdio;
void main()
{
int[] intArray;
intArray[0] = 42;
intArray[1] = 54;
intArray[2] = 91;
writefln("The lemgth of the intArray is %d.",
intArray.length);
}
[/code]
It compiles with no error or warning - AFAICT. However, it chokes
upon execution with:
dnormandin@ ~/programming/dmd2/code
01:40 pm >> arrays_in_d
core.exception.RangeError at arrays_in_d(7): Range violation
I've read and re-read the tutorial content, but it's not jumping out
at me.
--
duke
More information about the Digitalmars-d-learn
mailing list