(j3.2006) (SC22WG5.3584) OPTIONAL arguments and C interop

Bill Long longb
Thu Jul 17 10:43:35 EDT 2008



Van Snyder wrote:
>
> >From the point of view of a Fortran programmer who rarely or never uses
> C, VALUE just means "copy in." 

I don't know any other Fortran programmer who thinks this.  VALUE to a 
Fortran programmer means pass the argument in a register.  The entire 
purpose, outside the C Interop domain, is performance.  That was the 
reason VALUE was proposed to apply outside BIND(C) routines.


>  Whether the processor under the covers
> has the caller pass the address of the actual argument to the procedure,
> who then takes a copy, or has the caller take a copy which is then
> passed to the procedure (perhaps by address), is irrelevant.  

Sure, but neither of these options is very appealing. How the call is 
done is what matters.  If you don't get the performance advantage of 
VALUE when calling Fortran-to-Fortran, then there is no point in using 
it, and it should have been left to be part of C Interop only.


> Either
> way, OPTIONAL seems not to cause a problem, unless your code generator
> is stuck on C. 

Almost all compilers use the same code generator for both Fortran and C.

Cheers,
Bill

>  The real problem is with C interop, not whether Fortran
> allows VALUE + OPTIONAL in Fortran-to-Fortran interfaces.
>
>   

-- 
Bill Long                                   longb at cray.com
Fortran Technical Support    &              voice: 651-605-9024
Bioinformatics Software Development         fax:   651-605-9142
Cray Inc., 1340 Mendota Heights Rd., Mendota Heights, MN, 55120

            




More information about the J3 mailing list