$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
From: Jarl Lindrud (jlindrud_at_[hidden])
Date: 2005-04-17 09:05:57
Yariv Tal <yariv_tal2003 <at> hotmail.com> writes:
> 
> Is there a need for a Design by Contract (a.k.a Pre & Post conditions)
> library?
I tried to write something like this a while ago: http://www.codeproject.
com/cpp/DesignByContract.asp .
How much impact do your macros have on compile times? I found that the lambda 
expressions used to implement postconditions really took a toll on compile times 
with Visual C++ 7.1, and on other compilers, gcc for instance, its probably even 
worse.
Since these macros are part of the function implementation, maybe one shouldn't 
borrow the name "Design By Contract", since that implies a contract external to 
the function. Proper DbC contracts need to be stated at the level of function 
declarations, and would apply to overrides in derived classes as well.
Trying to simulate DbC through macros is a battle waiting to be lost, I think. 
I'd be more interested in a good POSTCONDITION macro, that works like an 
assertion, except that it kicks in when leaving the surrounding scope. Then 
people can do whatever they want with it, including rudimentary "DbC".
My $0.02.
/Jarl.