[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

[ANN] Design by Contract for C

Charles Mills

10/29/2004 2:44:00 PM

I am pleased to announce the first public release of DBC for C - a C
preprocessor that generates contract testing code and documentation
from DBC tags embedded in C comments. Here is an example:
/**
pre: i >= 0
pre: i < array->length
post: array->array[i] == elem
*/
void
Array_put(T array, long i, void *elem)
{
array->array[i] = elem;
}

DBC for C supports preconditions, postconditions, invariants and some
iterating operators (forall, exists). Also DBC for C can generate
Doxygen documentation from contracts. For more information take a look
at this article:
http://www.onlamp.com/pub/a/onlamp/2...
design_by_contract_in_c.html
(also featured on the front page of onlamp.com :)

Project Wiki:
http://dbc.rubyforge.org/wi...
Download page:
http://rubyforge.org/frs/?gr...

The DBC for C source package contains an example library, found in the
test_app directory.

DBC for C was created with Ruby and Racc.

Many thanks to Marcel Molina Jr. for proof reading the article, Daniel
Berger for submitting the first bug report, and Dave Thomas for writing
the book that got this started.

Enjoy!

-Charlie

PS. Feed back is welcome.



3 Answers

Robert Klemme

10/29/2004 3:11:00 PM

0


"Charles Mills" <cmills@freeshell.org> schrieb im Newsbeitrag
news:E7BDC4FA-29B8-11D9-9E2C-000A95A27A10@freeshell.org...
> I am pleased to announce the first public release of DBC for C - a C
> preprocessor that generates contract testing code and documentation
> from DBC tags embedded in C comments. Here is an example:

> DBC for C supports preconditions, postconditions, invariants and some
> iterating operators (forall, exists). Also DBC for C can generate
> Doxygen documentation from contracts. For more information take a look
> at this article:

> PS. Feed back is welcome.

Sounds like a great piece of work!

I just wonder: are you really trying to make C safe? Sounds like an
oxymoron... :-)

Kind regards

robert

Charles Mills

10/29/2004 3:33:00 PM

0

On Oct 29, 2004, at 8:13 AM, Robert Klemme wrote:

>
> "Charles Mills" <cmills@freeshell.org> schrieb im Newsbeitrag
> news:E7BDC4FA-29B8-11D9-9E2C-000A95A27A10@freeshell.org...
>> I am pleased to announce the first public release of DBC for C - a C
>> preprocessor that generates contract testing code and documentation
>> from DBC tags embedded in C comments. Here is an example:
>
>> DBC for C supports preconditions, postconditions, invariants and some
>> iterating operators (forall, exists). Also DBC for C can generate
>> Doxygen documentation from contracts. For more information take a
>> look
>> at this article:
>
>> PS. Feed back is welcome.
>
> Sounds like a great piece of work!
>
> I just wonder: are you really trying to make C safe? Sounds like an
> oxymoron... :-)

No and certainly DBC for C is not a one-size fits all solution. But,
it is very helpful if your doing OO style C programming.

Best,
Charlie



bazad

11/2/2004 8:44:00 PM

0

Charles Mills <cmills@freeshell.org> writes:

> On Oct 29, 2004, at 8:13 AM, Robert Klemme wrote:
>
> >
> > "Charles Mills" <cmills@freeshell.org> schrieb im Newsbeitrag
> > news:E7BDC4FA-29B8-11D9-9E2C-000A95A27A10@freeshell.org...
> >> I am pleased to announce the first public release of DBC for C - a C
> >> preprocessor that generates contract testing code and documentation
> >> from DBC tags embedded in C comments. Here is an example:
> >
> >> DBC for C supports preconditions, postconditions, invariants and some
> >> iterating operators (forall, exists). Also DBC for C can generate
> >> Doxygen documentation from contracts. For more information take a
> >> look
> >> at this article:
> >
> >> PS. Feed back is welcome.
> >
> > Sounds like a great piece of work!
> >
> > I just wonder: are you really trying to make C safe? Sounds like an
> > oxymoron... :-)
>
> No and certainly DBC for C is not a one-size fits all solution. But,
> it is very helpful if your doing OO style C programming.

Objective-C is good way to do OO in C :)