This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: V3 PATCH: numeric_limits<> support, fix PR/3865
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Roger Sayle <roger at eyesopen dot com>
- Cc: Richard Henderson <rth at redhat dot com>, <gcc-patches at gcc dot gnu dot org>, <libstdc++ at gcc dot gnu dot org>, Ulrich Drepper <drepper at redhat dot com>
- Date: 04 Sep 2002 11:10:40 +0200
- Subject: Re: V3 PATCH: numeric_limits<> support, fix PR/3865
- Organization: Integrable Solutions
- References: <Pine.LNX.4.33.0209031742350.5663-100000@www.eyesopen.com>
Roger Sayle <roger@eyesopen.com> writes:
| On Tue, 3 Sep 2002, Richard Henderson wrote:
| > On Tue, Sep 03, 2002 at 11:57:46AM -0600, Roger Sayle wrote:
| > > bool has_snan = !(__builtin_snan("") == 0.0);
| >
| > If -fsignaling-nan, this ought to result in sigfpe.
| > Thus you can't do that.
|
| Is there any agreement on evaluating constant expressions containing
| signaling NaNs at compile time. I agree that if the above statement
| where executed at run-time I'd expect a SIGFPE, but as an initializer
| to a global constant?
If the above expression is not evaluated at compile-time, it isn't
suitable for initializing numeric_limits<>::has_signaling_NaN since
C++ imposes the following constraint:
18.2.1/3
For all members declared static const in the numeric_limits
template, specializations shall define these values in such a way
that they are usable as integral constant expressions.
-- Gaby