Comparison macros

Document: N1442
Date: 21-Mar-10
Author: P.J. Plauger

In 7.12.14 Comparison Macros, the Working Draft currently define the macros:
int isgreater(real-floating x, real-floating y);
int isgreaterequal(real-floating x, real-floating y);
int isless(real-floating x, real-floating y);
int islessequal(real-floating x, real-floating y);
int islessgreater(real-floating x, real-floating y);
int isunordered(real-floating x, real-floating y);
All we say in the preamble to this clause is:
In the synopses in this subclause, real-floating indicates that the argument shall be an expression of real floating type.
Nothing is said, one way or the other, about whether the two arguments must have the same real-floating type. But in the C++ Standard, clause 26.8 para. 12, the analogous templates are:
template <class T> bool isgreater(T x, T y);
template <class T> bool isgreaterequal(T x, T y);
template <class T> bool isless(T x, T y);
template <class T> bool islessequal(T x, T y);
template <class T> bool islessgreater(T x, T y);
template <class T> bool isunordered(T x, T y);
which comes down on the side of same-type arguments. We have two choices:
  1. Clarify in the C standard that the arguments must have the same-type, or at least that it is implementation defined what happens if they do not.
  2. Clarify in the C standard that the arguments may have different types, and file a comment against the current C++ FCD that the templates should be changed to:
    template <class T, class U> bool isgreater(T x, U y);
    etc.
I prefer the first choice.