Boost logo

Boost :

From: Terje Slettebø (tslettebo_at_[hidden])
Date: 2003-03-09 21:16:38


>From: "David Abrahams" <dave_at_[hidden]>

> Terje Slettebø <tslettebo_at_[hidden]> writes:
>
> >>From: "David Abrahams" <dave_at_[hidden]>
> >
> >> I like the basic idea, but are you sure it will work in all the
> >> contexts where BOOST_STATIC_ASSERT works? I think BOOST_STATIC_ASSERT
> >> functions like a declaration, syntactically.
> >
> > Then how about simply:
> >
> > #ifndef STATIC_NDEBUG
> > # define BOOST_STATIC_ASSERT2(e) BOOST_STATIC_ASSERT(e)
> > #else
> > # define BOOST_STATIC_ASSERT2(e) // Possibly "void(0)" here, like
> > "assert"
> > #endif
> >
> > By the way, what's the point with "void(0)", compared to nothing? Both
> > "void(0);" and ";" are valid statements.
>
> is ";" legal where a declaration is expected?
>
> class X
> {
> ; // legal?
> };

Apparently not. "void(0)" doesn't work, either, so we need something else to
let it pass where declarations are allowed, as you say. It should be quite
easy. Of course, if BOOST_STATIC_ASSERT didn't require a ";" when used, one
could get away with defining it to nothing, as above, when STATIC_NDEBUG is
not set.

Defining it to BOOST_STATIC_ASSERT(true), as Jaap suggests in a recent
posting is also an option, if much of the processing is done in the
parameter passed, rather than in the macro itself (which is typically a
typedef or enum), which is likely.

Regards,

Terje


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