Conditional compilation for non-release version

F i L witte2008 at gmail.com
Sat Apr 28 06:03:10 PDT 2012


asserts aren't compiled into release builds (except 
assert(false)). So, if the loop only contains asserts, the 
compiler *should* be able to strip out the loop altogether. I 
don't know if DMD actually does that, though.

Or you could use debug statements:

     debug foreach (x; largeArray) {

         ...
     }

you'll need to compile with "-debug" for the loop to be included.


More information about the Digitalmars-d-learn mailing list