This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC 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: Invalid code in <limits>


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~


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