How to make invariant switchable

Max Samukha outer at space.com
Fri Jun 19 09:39:07 PDT 2009


On Fri, 19 Jun 2009 05:31:14 -0400, Christian Kamm
<see-ldc-commits at repository.com> wrote:

>Max Samukha Wrote:
>> You have a point. With current dmd, you can include unittests in the
>> release build. So why not asserts? But I don't think it's a good
>> solution to force people who don't want asserts in a final product to
>> prepend each and every assert with 'debug'. For assertions that should
>> stay in production, use 'if' conditions in D1 or std.contracts.enforce
>> in D2. Anyway, it would be nice to have a switch to retain debug
>> assertions in the release build. 
>
>LDC has the -enable-* and -disable-* command line options for asserts, array bounds checking, invariants and contracts to allow fine grained control over what is emitted and what isn't.

Nice! No support for D2, sadly



More information about the Digitalmars-d mailing list