[MPI3 Fortran] Variable length argument lists

Jeff Squyres jsquyres at cisco.com
Tue Oct 21 07:47:08 CDT 2008


Excellent; many thanks.

On Oct 21, 2008, at 7:36 AM, Lionel, Steve wrote:

> Fortran does not have variable-length argument lists.  It does have
> optional arguments.  The only context in Fortran where one sees  
> anything
> that looks like variable argument lists is in the MAX and MIN  
> intrinsics
> which have an unspecified number of arguments designated A1, A2, A3,
> etc.  This cannot be expressed in Fortran source. As best as I can  
> tell,
> the proper action is to remove the ",..." from the callback signature.
> I would guess that this is intended to pass some sort of user  
> context to
> the callback routine, which is a helpful idea.  You could define an
> optional CONTEXT argument of type C_PTR, but this would require  
> existing
> applications to be rebuilt using a module providing an explicit
> interface.  Possibly more trouble than it's worth.
>
> It is also not correct to say "you can pass as many/few arguments as  
> you
> want".   While this may work with some implementations, with others it
> does not.
>
>
> Steve Lionel
> Developer Products Division
> Intel Corporation
> Nashua, NH
>
>
>
>
>> -----Original Message-----
>> From: mpi3-fortran-bounces at lists.mpi-forum.org [mailto:mpi3-fortran-
>> bounces at lists.mpi-forum.org] On Behalf Of Jeff Squyres
>> Sent: Tuesday, October 21, 2008 7:23 AM
>> To: MPI-3 Fortran working group
>> Subject: [MPI3 Fortran] Variable length argument lists
>> Importance: Low
>>
>> Fortran experts --
>>
>> The MPI 2.1 spec lists some Fortran callback signatures as having
>> variable arguments.  I do believe that this is a holdover from a  
>> long,
>> long time ago, and I believe that whoever wrote this section simply
>> copied the C prototypes.  If the spec is wrong, I'd like to get it
>> fixed during the ongoing MPI-2.1 process.  See MPI-2.1 p266 line 29,
>> or http://www.mpi-forum.org/docs/mpi21-report-bw/node183.htm#Node183.
>>
>> The Fortran callback signature is expressed as:
>>
>> SUBROUTINE COMM_ERRHANDLER_FN(COMM, ERROR_CODE, ...)
>> INTEGER COMM, ERROR_CODE
>>
>> 1. Does Fortran have variable length argument lists (akin to C
>> varargs)?  If so, was it introduced in a specific version of Fortran?
>> (I realize that F77 compilers do no checking and you can pass as  
>> many/
>> few arguments as you want)
>>
>> 2. If Fortran has variable length argument lists, what is the correct
>> syntax to express them?  Is "..." correct?  Or is there a different
>> way?
>>
>> Thanks.
>>
>> --
>> Jeff Squyres
>> Cisco Systems
>>
>> _______________________________________________
>> mpi3-fortran mailing list
>> mpi3-fortran at lists.mpi-forum.org
>> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-fortran
>
> _______________________________________________
> mpi3-fortran mailing list
> mpi3-fortran at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi3-fortran


-- 
Jeff Squyres
Cisco Systems




More information about the mpiwg-fortran mailing list