This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Invalid code in <limits>
- From: Richard Henderson <rth at redhat dot com>
- To: Mark Mitchell <mark at codesourcery dot com>
- Cc: gcc at gcc dot gnu dot org, gdr at integrable-solutions dot net
- Date: Wed, 29 Jan 2003 00:01:33 -0800
- Subject: Re: Invalid code in <limits>
- References: <200301290534.h0T5YgU04467@localhost.localdomain>
On Tue, Jan 28, 2003 at 09:34:42PM -0800, Mark Mitchell wrote:
> static const bool has_infinity
> = __builtin_huge_valf () / 2 == __builtin_huge_valf ();
>
> Syntactically, a function call cannot appear in a constant-expression,
> which is what is required for a static member initializer.
I know. This was discussed at the time, that these needed
to be evaluable as constants. Seemed easy enough...
> One way to fix this would to be to introduce magic variables as well
> as the builtin functions. These magic variables would be defined
> like:
>
> static const __builtin_huge_valf_constant = <the value>;
No, see __builtin_nan("0x12345").
Plus, I don't see how this helps. A name's a name, isn't it?
How does having a magic variable work out better than a magic
function? Seems like you still go through name lookup...
r~