Conditional compilation for non-release version

Joseph Rushton Wakeling joseph.wakeling at webdrake.net
Sat Apr 28 07:00:17 PDT 2012


On 28/04/12 15:03, F i L wrote:
> Or you could use debug statements:

Yes, that was what I wanted to avoid -- I wanted the tests to be there by 
default, not only when debugging ... :-)

AFAICS the foreach loop probably does get optimized out by the compiler (I'm 
using GDC); if anything is left, the time it adds is negligible compared to the 
natural variation in runtime of the program.

In the end I decided to play ultra-safe and add assert() statements in every 
context where the array entries are used.  Those extra checks don't actually add 
anything to the non-release runtime, so far as I can tell.


More information about the Digitalmars-d-learn mailing list