Does anyone know this mysterious operator ">?" in gcc
Does anyone know about >? operator? I have a macro with the definition below that causes an error, but I still have not seen such an operator:
#define MAX_SIZEOF2(a,b) (sizeof(a) >? sizeof(b)) Minimum and maximum operators are the deprecated gcc extension :
The minimum and maximum g ++ operators ('
<?And'>?) And their composite forms ('>?=) And<?=)<?=deprecated and are now removed from g ++. Code using these operators must be modified to usestd::minandstd::maxinstead.
Here is what is written in the old documentation :
It is very convenient to have statements that return a βminimumβ or βmaximumβ of two arguments. In GNU C ++ (but not in GNU C),
a <? b- this is the minimum returning smaller numeric values ββa and b;
a >? b- the maximum value that returns a larger number of numeric values ββa and b.
This had the advantage of allowing you to avoid macros that might have problems with side effects if they weren't used carefully.
I assume it was removed from GCC 4.2
The equivalent a >?= b is equal to a = max(a,b);
From the manual
The minimum and maximum g ++ operators ('
<?And'>?) And their composite forms ('>?=) And'<?=)<?=deprecated and are now removed from g ++. Code using these operators must be modified to usestd::minandstd::max.
EDIT:
From your comments, you need to add #include <algorithm> to use std::max and std::min . You can also check this for reference .
This is an outdated non-standard operator that gives maximum of its operands. GCC no longer supports it.
In C ++, this is equivalent to std::max(sizeof(a), sizeof(b)) .