|
Boost : |
Subject: Re: [boost] [numeric] Adding numeric_cast_traits.hpp on 08/11 (today) breaks trunk
From: Daniel James (dnljms_at_[hidden])
Date: 2011-08-12 08:39:10
On 12 August 2011 13:20, Brandon Kohn <blkohn_at_[hidden]> wrote:
>
> Thanks :). I'm looking at the fix and don't understand why #elif was
> breaking there. I did my compiles on msvc-10 and gcc-4.3.4/cygwin with no
> issues.
This has come up before. The problem is with code like this:
#if !defined(SOMETHING)
#elif SOMETHING() == 1
#endif
In recent versions of gcc it fails when SOMETHING isn't defined
because the 'SOMETHING() == 1' clause is always evaluated - even
though the if statement has already been resolved. This is apparently
compliant with the standard.
The solution is to write:
#if !defined(SOMETHING)
#else
# if SOMETHING() == 1
# endif
#endif
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk