why >?=
and <?=
don't work in VC++?
but they work fine in gcc/g++
like: a>?=b
;
are they right usages?
views:
212answers:
2Because those are the old GC++-specific extensions for minimum and maximum.
From 6. Extensions to the C++ Language:
The GNU compiler provides these extensions to the C++ language (and you can also use most of the C language extensions in your C++ programs). If you want to write code that checks whether these features are available, you can test for the GNU compiler the same way as for C programs: check for a predefined macro
__GNUC__
. You can also use__GNUG__
to test specifically for GNU C++ (see section 'Predefined Macros' in The GNU C Preprocessor).
- 6.1 Minimum and Maximum Operators in C++ C++ Minimum and maximum operators.
- ...
Instead, you should use std::min
and std::max
.
Those operators are non-standard and are deprecated in GCC. They are not even supported in G++ at all anymore. You should use std::min and std::max instead. Be sure to #define NOMINMAX to disable the window-specific macros that conflict with them.