version(assert) and Phobos release unittest build
Jonathan M Davis
jmdavisProg at gmx.com
Thu Nov 28 11:00:30 PST 2013
On Thursday, November 28, 2013 17:40:55 Dicebot wrote:
> I have quickly tested it and looks like asserts are not removed
> from unittest blocks in release builds, only from normal code.
> Which does not seem to be documented on dlang.org but was
> probably introduced exactly to prevent existing tests from
> breaking in release mode. I have just learned something new :)
Exactly. unittest block assertions are treated somewhat specially. They're
always around with -unittest, but all the others (aside from the ones which
can statically be determined to be false - e.g. assert(0)) get compiled out in
-released. So, if you're relying on an assertion to go off outside of a -
unittes block in -release, you're in big trouble.
- Jonathan M Davis
More information about the Digitalmars-d-learn
mailing list