int[10] a;
a[10] = 3; // Error, array index out of bounds
The idea is to allow powerful metal code, while providing constructs that make errors much less likely. For example,
if (a < b < c)
is allowed by C, but few C programmers can tell you what it means, and the appearance of it in code is almost always a bug. Instead of educating programmers with "don't do that", D makes it illegal. (If you really want it, you'd have to write it as: `(a < b) < c`. But notice you have to make an effort to write code that way, it is highly unlikely to be accidentally written.)
> Scrutinizing the logic of the code line by line at least 2 times after you've finished writing it.
I find it useful to go back through the logic a couple months later. I usually find a lot to improve :-)
> Scrutinizing the logic of the code line by line at least 2 times after you've finished writing it.
I find it useful to go back through the logic a couple months later. I usually find a lot to improve :-)