[cfe-commits] Patch for evaluating FP constant expressions
Chris Lattner
clattner at apple.com
Thu Nov 29 15:16:54 PST 2007
On Nov 29, 2007, at 3:13 PM, Neil Booth wrote:
> Chris Lattner wrote:-
>
>>>> Very interesting, I didn't realize that this was non-conforming:
>>>>
>>>> double x = -1.0;
>>>
>>> I don't understand? This is quite OK of course, and required to be
>>> accepted.
>>>
>>> I see a lot of confusion about initializers.
>>
>> You're much more of a standard's guru than I am, but my reading of
>> 6.6p7 would imply that this is an arithmetic constant expression, and
>> p8 says "An arithmetic constant expression shall have arithmetic type
>> and shall only have
>> operands that are integer constants, floating constants, enumeration
>> constants, character
>> constants, and sizeof expressions". That makes it sound like "- 1.0"
>> is not a valid c-e, no?
>
> Precisely which part makes it sound like that?
"An arithmetic constant expression shall... only have operands ..
that are floating constants"
Is this saying that any expression matching the constant expression
grammar production is allowed, as long as the leaves are only these
things? It sounds to me that it only allows direct fp constants, not
operators.
-Chris
More information about the cfe-commits
mailing list