I got a weird compilation error when using the condition statement.
a,b are int values, and the following expression gets a compilation error.
(a>b)?( std::cout << a ) : ( b=MAX ); 16 (b <unknown operator> 5)' (a>b)?( a=MAX ) : ( std::cout<<b ); 16 (&std::cout)->std::basic_ostream<_CharT, _Traits>::operator<< [with _CharT = char, _Traits = std::char_traits<char>](b)'
But this expression works well, which is odd ..
(a>b)?( std::cout << a ) : ( std::cout<<b );
I have no idea what makes such a difference, and I don't know why a compilation error occurs. Here is my gcc info:
Reading specs from ./../lib/gcc/mingw32/3.4.2/specs Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as --host= mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls --enable -languages=c,c++,f77,ada,objc,java --disable-win32-registry --disable-shared --e nable-sjlj-exceptions --enable-libgcj --disable-java-awt --without-x --enable-ja va-gc=boehm --disable-libgcj-debug --enable-interpreter --enable-hash-synchroniz ation --enable-libstdcxx-debug Thread model: win32 gcc version 3.4.2 (mingw-special)`
source share