D - [BUG](low) incorrect initializing of arrays not reported
- Manfred Nowak <svv1999 hotmail.com> Feb 06 2004
- J Anderson <REMOVEanderson badmama.com.au> Feb 06 2004
dmd 0.79, WIN98SE
void main(){
static int[] bar=[0,,,3];
printf("%d\n", bar[1]);
}
this compiles and outputs `3'.
So long.
Feb 06 2004
Manfred Nowak wrote:dmd 0.79, WIN98SE void main(){ static int[] bar=[0,,,3]; printf("%d\n", bar[1]); } this compiles and outputs `3'. So long.
This is to do with empty comma operators being ignored. If you did void main() { static int[] bar=[0,,,3]; printf("%d\n", bar.length); } you would get 2. The parhaps the code should cause a compilation error (or initialize emptys with the default (ie constructor)). -- -Anderson: http://badmama.com.au/~anderson/
Feb 06 2004








J Anderson <REMOVEanderson badmama.com.au>