DIP 1006 - Preliminary Review Round 1

Paolo Invernizzi paolo.invernizzi at gmail.com
Tue Mar 6 17:01:04 UTC 2018


On Tuesday, 6 March 2018 at 16:30:09 UTC, John Colvin wrote:
> On Tuesday, 6 March 2018 at 02:05:58 UTC, Walter Bright wrote:
>> On 3/5/2018 2:30 PM, John Colvin wrote:
>>> This just feels bad. Adding extra failsafes for my debug 
>>> program shouldn't make my release program less safe.
>>
>> Then use `enforce()`.
>
> So, to clarify, adding asserts to my code makes my release 
> builds violate @safe?

Only if the assert does not hold, you have _not_ tested it, and a 
future optimiser will use the assert expression for some hints 
that generated broken code.

At the end, I'm with Walter: you should have tested the code with 
the assert enabled, and you should have noticed that the assert 
it's not holding _before_ running the code in release without 
them.

/Paolo


More information about the Digitalmars-d mailing list