Contracts or Exceptions?

Kai Meyer kai at unixlords.com
Wed Mar 30 07:59:31 PDT 2011


On 03/30/2011 08:25 AM, Kagamin wrote:
> Kai Meyer Wrote:
>
>> do all the checking before hand. Arrays are a good example. When not in
>> -release mode, array boundaries are checked upon every access to the
>> array, and an exception is thrown if access goes out of bounds. In
>> -release mode, if you go out of bounds you get a segfault.
>
> No, you get a remote root vulnerability.

Sure, but the point is that arrays can be used in a way that performs as 
fast as possible, therefore it becomes the programmer's job to ensure 
that all access to the array is within bounds, which is faster than 
making the array check itself every time.


More information about the Digitalmars-d-learn mailing list