
Kim Barrett <kab.conundrums <at> verizon.net> writes:
Boost.ScopeExit uses a tricky bit of code (from Steven Watanabe) to allow a macro expansion to contain code which will declare a variable exactly once, regardless of how many times the macro is used in a given scope. Unfortunately, gcc4.3 -Wall generates a warning for this code in the second and later uses of the macro in the same scope. The warning is
comparisons like X<=Y<=Z do not have their mathematical meaning
It is complaining about a statement that gets parsed as
identifier < 0 > variable;
Valid code, and correct in this particular case, but the warning is there never the less.
Hi Kim, I don't understand how it works for the second use within one scope: boost::scope_exit::aux::holder< boost::scope_exit::aux::declare< sizeof(boost_scope_exit_args)
::apply<0>::apply_value boost_scope_exit_args;
If sizeof(boost_scope_exit_args) is equal to sizeof(declared), the resulting type would be holder<(0<0>::apply_value)>. But I don't see a global variable apply_value in your patch. BTW, I modified Steven's code and introduced a bug because sizeof(declare<sizeof(undeclared)>::apply<0>) does not necessarily equal to sizeof(declared). Alex