This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug math/21930] C-only gcc builtins used in <math.h> isinf


https://sourceware.org/bugzilla/show_bug.cgi?id=21930

--- Comment #2 from Gabriel F. T. Gomes <gftg at linux dot vnet.ibm.com> ---
(In reply to Joseph Myers from comment #1)

> (a) Don't define __HAVE_GENERIC_SELECTION for C++.

OK.

> (b) The use of __builtin_choose_expr is unnecessary, a conditional
> expression should suffice.  (__typeof *is* supported for C++, it's 
> __builtin_choose_expr and __builtin_types_compatible_p that aren't.)

OK.

> (c) Use some suitable C++ magic in place of __builtin_types_compatible_p
> (remembering that __builtin_types_compatible_p explicitly removes type
> qualifiers, and alternative C++ magic needs to do likewise).

Since typeid also removes qualifiers implicitly
(http://en.cppreference.com/w/cpp/language/typeid), would something in the
lines of the following be acceptable for c++98:

if (typeid(f) == typeid(float)) isinff (f)

Likewise for the other types and for the other functions (defined through
__MATH_TG)?


For C++11, we could use is_same, but we would need to remove the qualifiers
explicitly... Something in the lines of:

if (std::is_same<std::remove_cv<typeof(f)>::type, float>::value)

This seems more complex, so I wonder if I'm missing something in the proposed
test for c++98.

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]