DIP 1006 - Preliminary Review Round 1

Walter Bright newshound2 at digitalmars.com
Sun Mar 4 21:49:12 UTC 2018


On 3/4/2018 1:16 PM, Timon Gehr wrote:
> On 04.03.2018 21:40, Walter Bright wrote:
>> On 3/4/2018 4:05 AM, rjframe wrote:
>>> Would I be correct to interpret this as "turn them all off with -release"?
>>
>> Array bounds checking is left on with -release.
> 
> Not necessarily. If the code contains an explicit assertion that the index is in 
> bounds, then, according to the language specification, the bounds check may be 
> removed with -release.

D, as all languages that I know of do implicitly or explicitly, generates code 
based on the "as if" rule.


> I find the reasoning in terms of "on"/"off" confusing anyway.
> Does "off" mean "contract/assertion removed", or does it mean "failure is UB"?

"Off" means the check is removed. If the check does not hold, the program enters 
an invalid state, whether or not the check was actually done. An invalid state 
means subsequent execution is UB.


More information about the Digitalmars-d mailing list