Design By Contract

Chris Nicholson-Sauls ibisbasenji at gmail.com
Fri Nov 3 06:36:39 PST 2006


Mike Parker wrote:
> Don Clugston wrote:
> 
>>
>> In my C++ code, the most common bugs only occur in release mode. I 
>> stopped using debug mode for that reason; in C++, I normally only use 
>> the equivalent of -release and -release -debug.
> 
> 
> Which isn't really equivalent to DMD for most C++ compilers, where 
> specifying debug symbols also sets a special define (where as D's -debug 
> and -g are two different things). Some C++ compilers also handle 
> variable initialization differently when debug mode is turned on, which 
> is one reason why some bugs are more likely to show up in release mode. 
> All D's debug mode does is make version(debug) true.

And specify the first clause of any 'debug{...}else{...}' syntax.  But, I don't think 
using else clauses with debug is very common.  (I've only ever used it in one case myself, 
usually within version info modules for something like:

# // ...
# const char[] V_RELEASE ;
#
# // ...
# static this () {
#   // ...
#   debug V_RELEASE = r"Debug"c   ;
#   else  V_RELEASE = r"Release"c ;
#   // ...
# }

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list