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.
This is the "maximum" assignment operator, a GCC extension.
If the extension is not enabled, then you will not be able to use this feature.
The G++ minimum and maximum operators (
<?
and>?
) and their compound forms (<?=
) and>?=
) have been deprecated and will be removed in a future version. Code using these operators should be modified to use std::min and std::max instead.
It looks like they were gone by 4.0.4.