Design By Contract

Chris Nicholson-Sauls ibisbasenji at gmail.com
Wed Nov 1 21:27:47 PST 2006


Stephane Wirtel wrote:
> Hi all,
> 
> I don't know if there is a release mode or debug mode, so. I did not
> read the specs of D. I would like to known if is it possible to disable
> the design by contract in release mode ?
> 
> Thanks

Well, there is debug mode, release mode, and what I like to term "indifferent mode."  To 
get debug mode you, simply enough, pass the "-debug" command line switch to DMD.  To get 
release mode, you pass "-release" to it, which disables all the runtime features covered 
by Design-by-Contract, and a few other things.  To get "indifferent mode" just don't pass 
either switch.  I'm really not sure what to say about it, except that it neither passes 
the debug flag to the parser (there is a 'debug' attribute that can be used for applying 
debug-mode-only code, with an optional 'else' clause for its indifferent/release-mode 
counterpart), nor does it seem to cut out the features that release-mode cuts.  Its... 
just there.  Huh.

In short, essentially... yes.  In release mode, all runtime Design-by-Contract (and other 
related things) are gone.

-- Chris Nicholson-Sauls



More information about the Digitalmars-d mailing list