How to make invariant switchable

Christian Kamm see-ldc-commits at repository.com
Fri Jun 19 02:31:14 PDT 2009


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.




More information about the Digitalmars-d mailing list