V3 PATCH: numeric_limits<> support, fix PR/3865

Gabriel Dos Reis gdr@integrable-solutions.net
Wed Sep 4 02:19:00 GMT 2002


Richard Henderson <rth@redhat.com> writes:

| On Tue, Sep 03, 2002 at 05:47:16PM -0600, Roger Sayle wrote:
| > 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?
| 
| What's the distinction in C++, where global constants *can* 
| be initialized at runtime?

Global const objects can be intiialized at runtime in C++.  

However, the description of numeric_limits<> goes far beyond that and
makes the additional requirement that the static data members of
numeric_limits<> be defined in a way that makes them behave as
integral constant expressions -- that constraint excludes runtime
initialization. 

In some way, it makes sense to me to evaluate the __builtin_xxx
helpers at compile-time.  Do you have some cases in mind which would
defeat that?

-- Gaby



More information about the Libstdc++ mailing list