c++conditional-statements

Weird usage of conditional operator (>?=)


I was looking at some code and saw something like this:

int d = 1;
int somethingbigger = 2;

d >?= somethingbigger;

cout << d << endl;

I think this should output 2. But I can't even compile this with gcc 4.5.2. The code was written in 2005 and compiled with gcc 3.4.4 (not 100% sure).

Can someone explain how this works and why I can't compile this with a recent compiler.


Solution

  • This is the "maximum" assignment operator, a GCC extension.