(j3.2006) (SC22WG5.3584) OPTIONAL arguments and C interop
Van Snyder
Van.Snyder
Wed Jul 16 21:46:45 EDT 2008
On Wed, 2008-07-16 at 18:34 -0700, Robert Corbett wrote:
> Bill Long wrote:
>
> > At the last WG5 meeting we cut off debate on a couple of issues related
> > to the C Interop TR due to time running out before convergence occurred.
> >
> > One of the unresolved issues was the design for handling OPTIONAL
> > arguments in interfaces with BIND(C). The current design, which has
> > been static for a couple of years, is that missing actual arguments
> > corresponding to dummies with the OPTIONAL attribute are represented as
> > actual arguments with the value NULL. A side effect of this design is
> > that OPTIONAL and VALUE cannot be both specified for a particular dummy
> > argument.
>
> Ths initial specification of the VALUE attribute did not allow the
> combination of OPTIONAL and VALUE. The extension to allow them
> together was a late addition. Adding that extension was daft.
>From the point of view of a Fortran programmer who rarely or never uses
C, VALUE just means "copy in." 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. Either
way, OPTIONAL seems not to cause a problem, unless your code generator
is stuck on C. The real problem is with C interop, not whether Fortran
allows VALUE + OPTIONAL in Fortran-to-Fortran interfaces.
> Bob Corbett
> _______________________________________________
> J3 mailing list
> J3 at j3-fortran.org
> http://j3-fortran.org/mailman/listinfo/j3
More information about the J3
mailing list