Boost logo

Boost Users :

From: Paul Mensonides (pmenso57_at_[hidden])
Date: 2005-06-29 14:43:43

> -----Original Message-----
> From: boost-users-bounces_at_[hidden]
> [mailto:boost-users-bounces_at_[hidden]] On Behalf Of Dave Steffen

> Yes, I've seen this in the GCC documentation. Unfortunately, it
> doesn't help if you're doing the sort of preprocessor metaprogramming
> we're doing. In one case in particular, the end result of the macro
> really is supposed to be a _function declaration_, not a section of
> code.
> In another case, it shows up from the construct
> I don't claim to understand everything that's going on here (even
> remotely), but GCC 3.2 and 3.3 are very happy with the usage (in a
> header file)
> while 3.4 complains about that semicolon. What I'm asking is A) does
> anyone know if 3.4 has a particular -Wno-extra-semicolon, or
> equivalent, to turn off that warning; or B) what is the proper
> preprocessor metaprogramming technique to silence the warning.

The proper technique is to get rid of the semicolon. A macro invocation is not
an expression, though it may expand to one, and it is not a function call.
Adding the semicolon and then trying to get around the warning (which should be
an error) only encourages the view that macros invocations and function calls
are equivalent. Nearly all macro-related problems (other than name collision)
are a result of this fundamentally flawed perspective. The use of all caps
should be make it obvious that a macro is involved. Making macro invocations
appear more like function calls is evil--don't do it.

Paul Mensonides

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at