www.digitalmars.com         C & C++   DMDScript  

digitalmars.D - Design By Contract

reply Stephane Wirtel <stephane.wirtel gmail.com> writes:
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
Nov 01 2006
next sibling parent reply Tom S <h3r3tic remove.mat.uni.torun.pl> writes:
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 ?
You can't disable 'design by contract' but you can disable runtime checks, including invariants, asserts, in/out contracts and array bounds checking by passing -release to the compiler.
Nov 01 2006
parent Stephane Wirtel <stephane.wirtel gmail.com> writes:
 You can't disable 'design by contract' but you can disable runtime
 checks, including invariants, asserts, in/out contracts and array bounds
 checking by passing -release to the compiler.
thanks, stephane
Nov 01 2006
prev sibling parent reply Chris Nicholson-Sauls <ibisbasenji gmail.com> writes:
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
Nov 01 2006
next sibling parent =?ISO-8859-1?Q?Anders_F_Bj=F6rklund?= <afb algonet.se> writes:
Chris Nicholson-Sauls wrote:

 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 usually call it "contract mode" instead. --anders
Nov 02 2006
prev sibling parent reply Bruno Medeiros <brunodomedeiros+spam com.gmail> writes:
Chris Nicholson-Sauls wrote:
 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
And what do you call "-release -debug" mode? It's confusing (perhaps unnecessarily) but the two options are not related, there are 4 "modes". -- Bruno Medeiros - MSc in CS/E student http://www.prowiki.org/wiki4d/wiki.cgi?BrunoMedeiros#D
Nov 02 2006
parent reply Chris Nicholson-Sauls <ibisbasenji gmail.com> writes:
Bruno Medeiros wrote:
 Chris Nicholson-Sauls wrote:
 
 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
And what do you call "-release -debug" mode? It's confusing (perhaps unnecessarily) but the two options are not related, there are 4 "modes".
Personally, I call it "confounded mode" and never use it. Not even sure what use it could have. -- Chris Nicholson-Sauls
Nov 02 2006
parent reply Georg Wrede <georg.wrede nospam.org> writes:
Chris Nicholson-Sauls wrote:
 Bruno Medeiros wrote:
 
 Chris Nicholson-Sauls wrote:

 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
And what do you call "-release -debug" mode? It's confusing (perhaps unnecessarily) but the two options are not related, there are 4 "modes".
Personally, I call it "confounded mode" and never use it. Not even sure what use it could have.
Debugging release code? :-)
Nov 02 2006
parent reply Chris Nicholson-Sauls <ibisbasenji gmail.com> writes:
Georg Wrede wrote:
 Chris Nicholson-Sauls wrote:
 
 Bruno Medeiros wrote:

 Chris Nicholson-Sauls wrote:

 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
And what do you call "-release -debug" mode? It's confusing (perhaps unnecessarily) but the two options are not related, there are 4 "modes".
Personally, I call it "confounded mode" and never use it. Not even sure what use it could have.
Debugging release code? :-)
Thank you for this most wonderful headache. :) -- Chris Nicholson-Sauls
Nov 02 2006
parent reply Don Clugston <dac nospam.com.au> writes:
Chris Nicholson-Sauls wrote:
 Georg Wrede wrote:
 Chris Nicholson-Sauls wrote:

 Bruno Medeiros wrote:

 Chris Nicholson-Sauls wrote:

 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
And what do you call "-release -debug" mode? It's confusing (perhaps unnecessarily) but the two options are not related, there are 4 "modes".
Personally, I call it "confounded mode" and never use it. Not even sure what use it could have.
Debugging release code? :-)
Thank you for this most wonderful headache. :)
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.
Nov 03 2006
parent reply Mike Parker <aldacron71 yahoo.com> writes:
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.
Nov 03 2006
parent Chris Nicholson-Sauls <ibisbasenji gmail.com> writes:
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: -- Chris Nicholson-Sauls
Nov 03 2006