On 7/29/14, 12:35 PM, Walter Bright wrote:
On 7/29/2014 3:13 AM, Dicebot wrote:
On Tuesday, 29 July 2014 at 07:31:26 UTC, Walter Bright wrote:
You can choose to disable assertions with a switch, or not. Having a
choice up
to you doesn't make it useless.

Yes I know what are options to make it work. I don't know how to make
it work
"in a good style". This is not just D problem - I feel like something
is missing
in the design by contract idea, something that actually can make it
robust
enough to be used without "oh crap" moments.

To have an assert despite -release, you can do things like:

    assert(exp);  =>  if (!exp) assert(0);

Fancier: exp || assert(0) is still an expression.

I generally leave asserts in for released code in my projects. You can
see this in dmd which often exhibits a fault as a tripped assert.

I wonder how fast dmd would be if we turned assertions off. Would be an interesting experiment to run.


Andrei

Reply via email to