Boost logo

Boost :

Subject: Re: [boost] [preprocessor] BOOST_PP_OVERLOAD not defined if variadic macros not supported.
From: Edward Diener (eldiener_at_[hidden])
Date: 2013-04-07 18:30:21


On 4/6/2013 4:26 AM, Mostafa wrote:
> I just found out the hard way that BOOST_PP_OVERLOAD is "silently" not
> defined if variadic macros are not supported , ie in c++03. This led to
> quite a frustrating session of debugging on the premise that there's
> something wrong with my include paths/environment variables.

Some compilers supported variadic macros even as part of C++03 support.

>
> It would be very nice if BOOST_PP_OVERLOAD errored explicitly if
> variadic macros were not supported by the compiler, or at lease have a
> gentle reminder to the reader in BOOST_PP_OVERLOAD documentation (and,
> where appropriate, in other places) that variadic macros are only
> standard in c++11 and may not be supported on all compilers, hence one
> might get a BOOST_PP_OVERLOAD undeclared error.

The first line of BOOST_PP_OVERLOAD is:

"The BOOST_PP_OVERLOAD variadic macro expands to the name of a
non-variadic macro having a given number of parameters."

Any variadic macro in the Boost PP library needs variadic macro support
by the compiler.

If you think your compiler supports variadic macros but the Boost PP
library sets BOOST_PP_VARIADICS to 0, you can manually set it it 1
before using variadic macros in Boost PP. If your use of variadic macros
still fails it will mean your compiler does not support variadic macros.


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