Digital Mars C++ Compiler

Digital Mars C++ Compiler is the only C++ compiler which implements DbC. It isn’t an open source project, but we can get it free. A programmer can write the contract naturally with this compiler.

It was developed by Walter Bright who is the D programming language developer. D is based on Digital Mars C++ Compiler.

How to write the contract with this compiler? We must write under-score as prefix for the contract:

long square_root(long x)
__in
{
assert(x >= 0);
}
__out (result)
{
assert((result * result) == x);
}
__body
{
return
sqrt(x);
}

That DbC is like to D’s style.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s