
12 Aug
2011
12 Aug
'11
12:39 p.m.
On 12 August 2011 13:20, Brandon Kohn <blkohn@hotmail.com> 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