Does anyone know about >?
operator? I have a macro with below definition which is throwing error, but I have never seen such an operator till now:
#define MAX_SIZEOF2(a,b) (sizeof(a) >? sizeof(b))
The minimum and maximum operators are a deprecated gcc extension:
The G++ minimum and maximum operators (‘
<?
’ and ‘>?
’) and their compound forms (‘>?=
’) and ‘<?=
’) have been deprecated and are now removed from G++. Code using these operators should be modified to usestd::min
andstd::max
instead.
Here is what the older documentation says:
It is very convenient to have operators which return the “minimum” or the “maximum” of two arguments. In GNU C++ (but not in GNU C),
a <? b
is the minimum, returning the smaller of the numeric values a and b;
a >? b
is the maximum, returning the larger of the numeric values a and b.
This had the advantage that it allowed you to avoid macros which could have issues with side-effects if they were not used carefully.
I guess it has been removed from GCC version 4.2
The equivalent of a >?= b
is a = max(a,b);
From the manual
The G++ minimum and maximum operators (‘
<?
’ and ‘>?
’) and their compound forms (‘>?=
’) and ‘<?=
’) have been deprecated and are now removed from G++. Code using these operators should be modified to usestd::min
andstd::max
instead.
EDIT:
From your comments, you need to add #include <algorithm>
to use the std::max
and std::min
. You can also check this for reference.
It's a deprecated non-standard operator which gives the maximum of its operands. GCC no longer supports it.
In C++, this is equivalent to std::max(sizeof(a), sizeof(b))
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With