This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ 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]

Re: C++ header file problem - is this a bug?


On Jan 4, 2005, at 9:54 PM, Bill Northcott wrote:


On 05/01/2005, at 6:27 AM, Dave Korn wrote:
Did you notice that you're writing C++, and ***NOT*** C?

As such, you should use the C++ library functions and headers, not the C
library functions and headers, since they're for a different programming
language.


Why aren't you using the std::isnan() function?

I can't find any documentation, and if I try to use it I get the following:
error: `isnan' undeclared in namespace `std'
which is unsurprising since it does not appear to be declared or defined in any header in /usr/include except math.h, which gets stuffed by cmath.


Would those be adequate reasons not to use it?

Just how is one expected to get isnan() functionality in a C++ program?

I'm not so sure our current behavior is correct either.


First, I don't understand the motivation for undefining isnan as a macro and then defining an std::isnan within namespace std. Yes, it's true that defining an isnan macro would violate the C++ standard. But then, defining an isnan function within namespace std violates the standard too. Why go to all this effort merely to change one kind of standard violation into another kind?

Second, as Bill has pointed out, we're not doing this completely. At least on Darwin, we're undefining that macro and replacing it with nothing.

I've hesitated to fix this behavior on Darwin because I've never seen a specification or documentation of what behavior we're trying to have, but I'm pretty sure it's not what we've got.

--Matt


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