The following:

import std.stdio;

void main() {
  int[5] arg;
arg[10] = 3; // Compiler says (of course): Error: array index 10 is out of bounds arg[0 .. 5]
}

import std.stdio;

void main() {
  int[5] arg;
  foreach (i; 0..10) {
    arg[i] = i;
  }
}

Compiler says nothing, but we get a runtime error 'Range violation'.

Bug or design?

Reply via email to