Boost logo

Boost :

From: Tobias Schwinger (tschwinger_at_[hidden])
Date: 2006-01-29 09:39:24

Arkadiy Vertleyb wrote:
> "Paul Mensonides" <pmenso57_at_[hidden]> wrote
>> [...] which creates pathological input that IF cannot deal with:
>> [...]

While we're at it:

This code (taken from boost/typeof/vector.hpp, line 106)

  BOOST_PP_IF(n, BOOST_PP_EMPTY(), class T = void)

seems to contain a similar (but more subtle) problem.

Emptiness (well, deferred emptiness in this case, to be precise) is passed to BOOST_PP_IF as the second argument, and empty input (to the macros used by BOOST_PP_IF internally) results in undefined behaviour -- so it's up to the preprocessor whether things work correctly or not.

For more details here's the thread where Paul explained this stuff to me:

For a quick fix, a more bullet-proof version could look like this



  BOOST_PP_EXPR_IIF(BOOST_PP_NOT(n), class T = void)




Boost list run by bdawes at, gregod at, cpdaniel at, john at