Boost logo

Boost :

From: Andrei Alexandrescu (andrewalex_at_[hidden])
Date: 2001-11-24 13:21:47


> > #define STATIC_ASSERT_MSG(b, msg) \
> > { \
> ^
> > struct msg \
> > { \
> > msg(::boost::loki::int2type<true>) {} \
> > } msg(::boost::loki::int2type<(b) != 0>()); \
> > }
> ^
> The above STATIC_ASSERT_MSG macro can only be used in function scope which
> highly limits its use. IMHO, an industry strength STATIC_CHECK must be
usable
> at:
> - namespace,
> - class, and
> - function scope.

I know. The current STATIC_ASSERT has the same drawback. Would be good to
add something in that direction, too.

> if (expr_1)
> if (expr_2)
> STATIC_CHECK(const_expr);
> else
> stmt_1();
>
> When will stmt_1() be executed?
>
> So, use "do {...} while (0)" instead of "{ ... }".

I thought this is self-understood as it is a well-known idiom for creating
macros. I was actually surprised to see that boost doesn't apply this idiom
all over, and I was going to complain about that.

So by this message I am complaining :o).

> IMHO it is not imperative to have the compiler error message readable

IMHO it is very good to have the compiler error message readable if you can.

Andrei


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