[MPI3 Fortran] Proposing changes to Fortran 2008

Craig Rasmussen crasmussen at lanl.gov
Tue Mar 18 09:03:32 CDT 2008


On Mar 14, 2008, at 2:47 PM, Lionel, Steve wrote:

> Aleksandar Donev wrote:
>
>> A possible solution is something like:
>>
>> interface
>> subroutine mpi_send(buffer...) bind(c)
>>     type(c_void), dimension(*) :: buffer
>> end subroutine
>> end interface
>>
>>
> My opinion on this is that "type(c_void)" is not consistent with the
> Fortran language.  I'd propose instead that a new VOID attribute be
> allowed in declarations of dummy arguments.  The argument could be
> declared as having any type (INTEGER would do) - but a dummy with the
> VOID attribute would match any actual argument TKR (Type, Kind, Rank).
> Indeed, many commercial compilers already implement this concept,  
> though
> each spells it differently (with some sort of comment-looking  
> directive,
> such as Intel's !DEC$ ATTRIBUTES NO_ARG_CHECK).
>
> I feel that a VOID attribute is more natural to Fortran in that it  
> does
> not require a special case for a specially named derived type (note  
> that
> one ought to be able to write the module ISO_C_BINDING in Fortran
> (perhaps with some extensions), and we in fact do so.)  I think this
> would also be easy for programmers to understand the correspondence  
> with
> C's void (un)type.
>

I note my suggestion earlier that in Aleks' proposal that c_void be  
treated much like c_ptr is now to allow the interface to be  
implementable in Fortran.

> So with my proposal, the interface above would be written:
>
> interface
>  subroutine mpi_send(buffer...) bind(c)
>      integer, dimension(*), void :: buffer
>  end subroutine
> end interface
>
> In this case, the dimension(*) is really there for the reader - the
> compiler ignores it.
>

Unfortunately the integer declaration is just for show also.  What is  
really meant in

        void :: buffer

and everything else is just to get around the fact we can't have a  
void type in Fortran.  This is why I like type(c_void) better as it  
explicitly refers to a C type unavailable without the iso_c_binding  
module.

Cheers,
Craig




More information about the mpiwg-fortran mailing list