(j3.2006) procedure declaration and elementals

Malcolm Cohen malcolm
Sun Mar 15 20:22:17 EDT 2009



Bill Long wrote:
> I got this test case:
>
> program f2003_procptr_1
>   implicit none
>   real      :: pi = 3.14159265
>   intrinsic :: sin, cos
>
>   procedure(sin), pointer :: p => NULL ()
>
>   p => sin
>   print *, "sin(0), sin(pi/2) =", p(0.0), p(pi/2)
>
>   p => cos
>   print *, "cos(0), cos(pi)   =", p(0.0), p(pi)
>
> end program f2003_procptr_1
>
>
>
> The procedure declaration statement appears to violate C1219
> (09-007:[291:26-27]).
Not to me it doesn't.
>    What is the rationale for this constraint?
We have neither elemental procedure pointers nor elemental dummy 
procedures, so by elimination it must be an external procedure (if it is 
elemental).  This follows from the basic definitions, the constraint is 
not I guess really needed except that it requires diagnosis.
>   Is
> the code nonconforming?
>
>   
The code looks fine to me.

"sin" is the name of a specific intrinsic function, see C1216.  Maybe it 
should be said more clearly, but C1216 wouldn't make sense unless it 
referred to the specific.  Specifics can be passed as actual arguments, 
so obviously they are not elemental.

I'm not sure why we're all quoting 09-007 when we're talking about 
interpretation of F2003.  It's the wrong document!

Cheers,
-- 
.......................Malcolm Cohen, Nihon NAG, Tokyo.





More information about the J3 mailing list