Implementing p0515 - spaceship operator
Jonathan Wakely
jwakely.gcc@gmail.com
Thu Jan 11 10:13:00 GMT 2018
t all cleaOn 11 January 2018 at 10:05, David Brown wrote:
> Maybe it is easier to say "gcc supports <=> in C++2a, and as an
> extension also supports it in C and C++ of any standard" ? I don't
> believe there is any way for it to conflict with existing valid code, so
> it would do no harm as a gcc extension like that - and C users can then
> use it too.
It's not very useful in C because you need the comparison category
types, which are classes defined in <compare> (see
http://en.cppreference.com/w/cpp/header/compare)
C doesn't have those types, and can't define anything close.
And it's non-conforming to declare those types in pre-C++2a, because
the names could be used by user programs.
Potentially the types could be defined with reserved names like
__strong_ordering, and then make std::strong_ordering a typedef for
that, but there are also changes to the language spec that go with the
new operator, and enabling those pre-C++2a could change the meaning of
valid code.
So it's not ar it does no harm.
More information about the Gcc
mailing list