Title
templates defined in <cmath> replacing C macros with the same name
Status
resolved
Section
[c.math]
Submitter
Michael Wong

Created on 2010-03-07.00:00:00 last changed 162 months ago

Messages

Date: 2011-05-03.22:13:16

Proposed resolution:

Apply proposed resolution for US-136

Date: 2010-09-14.00:00:00

[ 2010-09-14 Bill comments: ]

Motion 27 directly addresses LWG 1327 and solves the problem presented there. Moreover, the solution has been aired before WG14 with no dissent. These functions now behave the same for mixed-mode calls in both C and C++

Date: 2010-09-13.00:00:00

[ 2010-09-13 Daniel comments: ]

I recommend to resolve this issue as NAD Editorial because the accepted resolution for NB comment US-136 by motion 27 does address this.

Date: 2010-10-21.18:28:33

[ 2010 Pittsburgh: Bill to ask WG-14 if heterogeneous support for the two-parameter macros is intended. ]

Date: 2010-03-07.00:00:00

In [c.math]p12 The templates defined in <cmath> replace the C99 macros with the same names. The templates have the following declarations:

namespace std {
template <class T> bool signbit(T x);
template <class T> int fpclassify(T x);
template <class T> bool isfinite(T x);
template <class T> bool isinf(T x);
template <class T> bool isnan(T x);
template <class T> bool isnormal(T x);
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);
}

and p13:

13 The templates behave the same as the C99 macros with corresponding names defined in C99 7.12.3, Classification macros, and C99 7.12.14, Comparison macros in the C standard.

The C Std versions look like this:

7.12.14.1/p1:

Synopsis

1 #include <math.h>

int isgreaterequal(real-floating x, real-floating y);

which is not necessarily the same types as is required by C++ since the two parameters may be different. Would it not be better if it were truly aligned with C?

History
Date User Action Args
2010-11-18 14:01:09adminsetstatus: nad editorial -> resolved
2010-10-29 02:13:40adminsetmessages: + msg5183
2010-10-29 02:13:40adminsetstatus: open -> nad editorial
2010-10-24 22:33:52adminsetmessages: + msg5083
2010-10-24 22:33:52adminsetmessages: + msg5082
2010-10-21 18:28:33adminsetmessages: + msg1608
2010-03-07 00:00:00admincreate