digitalmars.D.bugs - document error
- z gg.com (11/11) Sep 07 2005 http://www.digitalmars.com/d/arrays.html
http://www.digitalmars.com/d/arrays.html
section: Static Initialization of Static Arrays
enum Color { red, blue, green };
int value[Color.max] = [ blue:6, green:2, red:5 ];
It should be:
enum Color { red, blue, green };
int value[Color.max + 1] = [ Color.blue:6, Color.green:2, Color.red:5 ];
Otherwise:
Error: too many initializers 3 for array[2]
Actually I do hope enum.max === (element count in enum); instead of (the max
value, i.e. the value of the last number).
Sep 07 2005








z gg.com