[prev in list] [next in list] [prev in thread] [next in thread] 

List:       cfe-commits
Subject:    [cfe-commits] Patch for evaluating FP constant expressions
From:       clattner () apple ! com (Chris Lattner)
Date:       2007-11-29 23:07:04
Message-ID: 53DD9557-B535-4F5B-9E64-A9F38AB3F3D4 () apple ! com
[Download RAW message or body]


On Nov 29, 2007, at 2:37 PM, Neil Booth wrote:

> Chris Lattner wrote:-
>
>>> I needed this to support negation of FP literals, which is pretty
>>> unambiguous. It looks like GCC evaluates more complex constant
>>> expressions too, so I put in support for some of that (though
>>> rounding mode is an issue). All of this is modeled on the work for
>>> integer expressions and uses APFloat.
>>
>> 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?

-Chris

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic