This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: PATCH: 27_io/istream_extractor_arith.cc (take 2 or 3)
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: rittle at labs dot mot dot com
- Cc: libstdc++ at gcc dot gnu dot org, dave dot anglin at nrc dot ca
- Date: Tue, 5 Feb 2002 19:50:37 -0500 (EST)
- Subject: Re: PATCH: 27_io/istream_extractor_arith.cc (take 2 or 3)
> First of all, we try harder to use strtof() or strtold() when
> available even if all the machinery of C99 was not available
> (alphaev67-dec-osf5.1 and hopefully modern HP-UX). If we still have
> to use the other code path, then we try harder to catch error
> conditions related to casting strtod() result to float and similar
> tightening in the case of handling a long double (helps Solaris 2.7
> and FreeBSD).
>
> This code could be further improved once we have a generic portable
> way to test for infinity, etc. I am still looking at how I can
> improve errno handling in this file per Nathan's points.
>
> David, does this fix HP-UX for you? If not, willing to hack on it
> further after I commit it?
This will probably fix the problem on 10.20 but not 11.X. The reason
as I have noted is that 11.X isn't fully C99 compatible. As far as
libstdc++ goes, it appears to be mainly missing support for long doubles.
Because of this, the library configuration process disables all the C99
macros like isinf. Unfortunately, these are the only standard macros
or functions available on hpux 11 for testing floats. That only leaves
the non standard macros like _ISINF. These behave like isinf -- testing
both floats and doubles. If you don't mind using _ISINF, _ISFINITE, etc
in your patch, then the test can be fixed. Since they are macros, they
can be checked for with a simple "#ifdef". Here are the defines:
# define isnan(x) _ISNAN(x)
# define isinf(x) _ISINF(x)
# define signbit(x) _SIGNBIT(x)
# define isfinite(x) _ISFINITE(x)
# define isnormal(x) _ISNORMAL(x)
# define fpclassify(x) _FPCLASSIFY(x)
# define isunordered(x,y) _ISUNORDERED(x,y)
# define isgreater(x,y) _ISGREATER(x,y)
# define isgreaterequal(x,y) _ISGREATEREQUAL(x,y)
# define isless(x,y) _ISLESS(x,y)
# define islessequal(x,y) _ISLESSEQUAL(x,y)
# define islessgreater(x,y) _ISLESSGREATER(x,y)
I was going to try adding some of the missing C99 functions (Benjamin
was skeptical that this would work). However, other more pressing
issues have prevented me from trying this.
Dave
--
J. David Anglin dave.anglin@nrc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6605)