[Cfp-interest] [Fwd: (SC22WG14.12592) [Fwd: Comments on N1591 (binary floating point)]]

Jim Thomas jaswthomas at sbcglobal.net
Wed Feb 1 16:01:43 PST 2012


I don't believe this response from Joseph was sent to CFP. Those with compiler expertise, please look at it carefully. We want calls to standard library functions to be affected by constant rounding direction modes. We want to specify that the dynamic rounding mode will be in effect where the compiler can't reasonably know if the function to be called will be a standard library function - assuming there's a clean enough way to distinguish such cases.

-Jim 


On Jan 30, 2012, at 8:46 AM, Jim Thomas wrote:

> 
> 
> From: "Joseph S. Myers" <jsm at polyomino.org.uk>
> Subject: (SC22WG14.12592) [Cfp-interest] [Fwd: Comments on N1591 (binary floating point)]
> Date: January 24, 2012 11:09:37 AM PST
> To: wg14 <sc22wg14 at open-std.org>
> 
> 
> On Tue, 24 Jan 2012, Jim Thomas wrote:
> 
>>> (b) The constant rounding modes specification (7.6.2) refers to "Any call
>>> made through a function pointer".  The semantics specified by the C
>>> standard are that *all* calls to a function (as opposed to a macro) are
>>> through a function pointer; the function designator is converted,
>>> explicitly or implicitly, to pointer to function type, before it is used
>>> in a call.
>> 
>> Please provide a reference for the C standard specification.
> 
> 6.3.2.1 paragraph 4: "A function designator is an expression that has 
> function type. Except when it is the operand of the sizeof operator, the 
> _Alignof operator, or the unary & operator, a function designator with 
> type ``function returning type'' is converted to an expression that has 
> type ``pointer to function returning type''."
> 
> As noted in the footnote, "Because this conversion does not occur, the 
> operand of the sizeof or _Alignof operator remains a function designator 
> and violates the constraints in 6.5.3.4.".  6.5.3.2 paragraph 3 deals with 
> unary &.  So in every case of valid code, a function designator is 
> converted to a pointer to function, whether by 6.3.2.1 paragraph 4 or by 
> explicit unary &.  Function calls are then defined in 6.5.2.2 paragraph 1 
> with "The expression that denotes the called function shall have type 
> pointer to function returning void or returning a complete object type 
> other than an array type." and a footnote "Most often, this is the result 
> of converting an identifier that is a function designator.".
> 
> So all function calls go via a function pointer in the standard semantics.  
> f(), (f)(), (((f)))(), ((&((f))))() all involve a single conversion from 
> function designator to function pointer; (*f)(), for example, involves two 
> such conversions (the function designator f is converted implicitly to a 
> function pointer, the unary * converts it back to a function designator, 
> (*f) is still a function designator (as per the rules on parentheses, 
> 6.5.1 paragraph 5) which then gets converted implicitly to a function 
> pointer for the call).
> 
> -- 
> Joseph S. Myers
> jsm at polyomino.org.uk
> 
> 
> 
> 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.oakapple.net/pipermail/cfp-interest/attachments/20120201/808071f5/attachment.html 


More information about the Cfp-interest mailing list