What does "compares less than 0" mean?

"compares <0" in plain English is "compares less than zero".

This is a common shorthand, I believe.

So to apply this onto the entire sentence gives:

The expression a <=> b returns an object that compares less than zero if a is less than b, compares greater than zero if a is greater than b, and compares equal to zero if a and b are equal/equivalent.

Which is quite a mouthful. I can see why the authors would choose to use symbols.


What I am interested in, more exactly, is an equivalent expression of "compares <0". Does "compares <0" mean "evaluates to a negative number"?

First, we need to understand the difference between what you quoted and actual wording for the standard. What you quoted was just an explanation for what would actually get put into the standard.

The standard wording in P0515 for the language feature operator<=> is that it returns one of 5 possible types. Those types are defined by the library wording in P0768.

Those types are not integers. Or even enumerations. They are class types. Which means they have exactly and only the operations that the library defines for them. And the library wording is very specific about them:

The comparison category types’ relational and equality friend functions are specified with an anonymous parameter of unspecified type. This type shall be selected by the implementation such that these parameters can accept literal 0 as a corresponding argument. [Example: nullptr_t satisfies this requirement. — end example] In this context, the behaviour of a program that supplies an argument other than a literal 0 is undefined.

Therefore, Herb's text is translated directly into standard wording: it compares less than 0. No more, no less. Not "is a negative number"; it's a value type where the only thing you can do with it is comparing it to zero.

It's important to note how Herb's descriptive text "compares less than 0" translates to the actual standard text. The standard text in P0515 makes it clear that the result of 1 <=> 2 is strong_order::less. And the standard text in P0768 tells us that strong_order::less < 0 is true.

But it also tells us that all other comparisons are the functional equivalent of the descriptive phrase "compares less than 0".

For example, if -1 "compares less than 0", then that would also imply that it does not compare equal to zero. And that it does not compare greater than 0. It also implies that 0 does not compare less than -1. And so on.

P0768 tells us that the relationship between strong_order::less and the literal 0 fits all of the implications of the words "compares less than 0".


"acompares less than zero" means that a < 0 is true.

"a compares == 0 means that a == 0 is true.

The other expressions I'm sure make sense now right?