Contract Programming

M

mathieu

Hi there,

I found some contradicting information on the web. So my question
is: Will there be support for Design by Contract at language level in C
++0x ?

Thanks,
 
V

Victor Bazarov

mathieu said:
I found some contradicting information on the web. So my question
is: Will there be support for Design by Contract at language level in C
++0x ?

Uh... Do you mean concepts? They have been deferred (IOW will not
appear in the next Standard).

V
 
M

mathieu

Uh...  Do you mean concepts?  They have been deferred (IOW will not
appear in the next Standard).

No, I meant DbC:

http://en.wikipedia.org/wiki/Design_by_contract

For instance in D, you have:

http://www.digitalmars.com/d/2.0/dbc.html

Some compiler allow Pre/Post condition as an extension (not sure how
it works internally):

http://msdn.microsoft.com/en-us/library/d3bbz7tz(VS.80).aspx

<quote>
[Post( MustCheck=SA_Yes )] double* CalcSquareRoot
(
[Pre( Null=SA_No )] double* source,
unsigned int size
);

In the preceding example:
[Post ( MustCheck=SA_Yes)] requires caller to check the return value
of CalcSquareRoot
[Pre ( Null=SA_No)] requires caller to pass non-null parameter
"source" to CalcSquareRoot
</quote>

I am guessing this is a no, since I cannot see it anywhere on the
wikipage for C++0x.

Thanks anyway,
 
V

Victor Bazarov

mathieu said:
Uh... Do you mean concepts? They have been deferred (IOW will not
appear in the next Standard).

No, I meant DbC:

http://en.wikipedia.org/wiki/Design_by_contract
[..]
I am guessing this is a no, since I cannot see it anywhere on the
wikipage for C++0x.

Correct. It's a no. And I think you can check with the Committee
website for the language development. There are also publications by
the members of the Committee that might hint at where the language
is/will be going.

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,567
Members
45,041
Latest member
RomeoFarnh

Latest Threads

Top