How to make invariant switchable

Lars T. Kyllingstad public at kyllingen.NOSPAMnet
Thu Jun 18 23:51:40 PDT 2009


bearophile wrote:
> Max Samukha:
>> Why would you want to leave asserts in a release build while they are
>> supposed to be used for debugging?
> 
> If you look around on internet you will find lot of people that like to keep assertions in the final programs too.
> Is DMD itself compiled with asserts left inside? When DMD doesn't work if often spits out a file + line number that I think come from an assert.
> 
> Bye,
> bearophile


For assertions that are meant only for debugging, use assert (...). For 
assertions that should also be included in a release build, use 
enforce(...) from the std.contracts module.

-Lars



More information about the Digitalmars-d mailing list