Boost logo

Boost :

From: Greg Colvin (gcolvin_at_[hidden])
Date: 1999-08-31 14:07:01


From: Valentin Bonnard <Bonnard.V_at_[hidden]>
> Kevlin Henney wrote:
>
> > Valentin Bonnard wrote:
> > [...]
> > > For boost library authors, the first need is perhaps not as great as
> > > that for a user dotting their own code w/ assertions. Naming and
> > > describing what constraint was violated is often more useful to a
> > > library user than receiving a mysterious message about a piece of code
> > > they have nothing to do w/!
> >
> > This can easilly be done with a comment:
> >
> > // must fobnicate before we tweak
> > assert (x ? t(3) : 3434==i+j);
> >
> > And there was me thinking that the compiler ignored comments ;-)
> >
> > If you wish to do this 'properly' w/ assert:
> >
> > assert (("must fobnicate before we tweak", x ? t(3) : 3434==i+j));
>
> Then the string will take space in the program (I have read
> that it was a problem for big apps).

Unless the translator removes duplicate string literals?

> I would rather add an argument to assertion:
>
> assertion ("must fobnicate before we tweak", x ? t(3) : 3434==i+j);

How does this use less space?

Anyway, I prefer the string to be an optional second argument:
    assertion (x ? t(3) : 3434==i+j, "must fobnicate before we tweak");


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk