On 09-10-2011 13:24, Graham Cole wrote:
I understand from the documentation that the "-release" compiler switch turns off 
"array bounds checking for system and trusted functions".

Is it correct that the following code should seg fault when compiled with 
"-release" ?

string[string] h;
h["abc"] = "def";
string s = h["aaa"];

I.e. retrieving from an associative array for a non existent key.

I would have thought that an exception should be generated in this case when 
compiled with
"-release" (as it is when compiled without).

This code behaves the same when compiled by both D1 and D2.

Should I report this as a bug ?


To generate a sensible exception in the first place, you'd have to actually *do* bounds checking. When you disable bounds checking, you're just allowing it to read/write beyond the bounds of the array, which any sane OS won't be too happy with. :)

- Alex

Reply via email to