Comment #0 by collin.reeser — 2015-08-27T15:03:27Z
For exactly the same reason that the index-out-of-bounds runtime checks are useful for debugging purposes when compiling without the -release flag, decrements on the array .length attribute should be checked during runtime for underflow.
As it is now:
int main()
{
int[] a = [];
a.length--;
return 0;
}
Will yield:
core.exception.OutOfMemoryError@(0)
This should instead be an error message along the lines of the index-out-of-bounds exception that indicates what the problem actually is.
This is related to Issue 3933 from 2010 (there's still no line number on the error, which goes a long way to making this issue less important).
Comment #1 by robert.schadek — 2024-12-07T13:35:42Z