Boost logo

Boost :

From: Ed Brey (brey_at_[hidden])
Date: 2000-11-06 09:33:27


From: "John Maddock" <John_Maddock_at_[hidden]>
> >3. Example 2's static assert has a superfluous pair of parentheses.
> Example
> >3's second static assert has a superfluous pair of parentheses around
> >UnsignedInt. In both cases, the reader is left to wonder whether there
is
> >some bizarre reason that is a parentheses are needed that he just can't
> >think of.
>
> They're not superfluous: in example two, they are required to stop the
> comma in the middle of the expression being treated as a macro argument
> separator. In example 3, they are there as casts: these probably shouldn't
> be required, but I've been trying to work around some VC6 problems (not
> very successfully in this case).

Good point about example 2. A comment such as "extra parentheses needed to
prevent preprocessor from seeing comma as macro argument separator" would be
nice.

Example 3 threw me because it has been so long since I've seen a C-style
cast in boost, that I wasn't expecting it. Less astonishing would be
"BOOST_STATIC_ASSERT(UnsignedInt(-1) >= 0);" In trying this out on VC6, I
noticed a couple of things. One is that the keyword "Template" at the
beginning of the example has a capital T. The other is that even with that
problem corrected, VC6 doesn't handle this example no matter how the cast is
done. It shows the assertion as failing before the template is even
instantiated. This appears to just be another VC6 bug (works fine under
gcc), and since the code in question is just an example, there's no reason
to bother working around it, IMHO.


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