(j3.2006) parentheses around a variable that is an /expr/

Robert Corbett Robert.Corbett
Thu Dec 10 01:56:10 EST 2009


We recently started our implementation of /expr/s as variables (R602).
A question arose regarding whether or not an /expr/ used as a variable
could be enclosed in parentheses.  Constraint C602 states

     /expr/ shall be a reference to a function that has a pointer
     result.

Section 1.3.111.2 states

     function reference
     appearance of the procedure designator for a function, or
     operator symbol in a context requiring execution of the
     function during expression evaluation (12.5.3)

A naive reading of that section is that the procedure
designator or operator symbol is the function reference.  That
reading is clearly nonsensical.  A possible interpretation is
that the "context requiring exection of the function" is the
function reference.  Under that interpretation, the context
might include a parenthesized /fuinction-reference/.
Section 12.5.3, on the other hand, appears to allow only a
/function-reference/ or an application of an operator as a
function reference, which would exclude enclosing parentheses.

Is the intent that a variable that is an /expr/ is allowed to
be parenthesized?  Should the example

       (1 + P) = X

be considered standard-conforming Fortran 2008 code assuming
that + in this context returns a pointer to a numeric object,
or should only the unparenthesized form

       1 + P = X

be allowed?

Robert Corbett



More information about the J3 mailing list