Description
Problem
-
In Example 19.11,
MPI_X_TYPE_COMMIT
violates 2.6.2 and 2.6.3. I understand that this is an example for implementers of how to implement the Fortran API, but there's no need for it to use theMPI_
namespace and doing so may give users the wrong idea. -
Furthermore, the entire premise of this example is common but unspecified behavior of Fortran compilers, and I do not see the point of such an example, particularly when the features to write such code in a compliant manner has been in the Fortran standard for 20 years.
-
A lesser problem is that this example contains the ubiquitous Fortran anti-pattern of a
RETURN
statement at the end of the subroutine.
Proposal
I would prefer to remove this example for multiple reasons, but if folks insist on keeping it, it should be modified to be compliant with some version of the Fortran language, ideally Fortran 2003.
Changes to the Text
This is a standard-compliant example:
function MPI_Type_commit(datatype) result(ierr)
implicit none
interface
integer function C_MPI_Type_commit(datatype) &
bind(C,name="C_MPI_Type_commit")
integer, intent(inout) :: datatype
integer :: ierr
end function
end interface
integer, intent(inout) :: datatype
integer :: ierr
ierr = C_MPI_Type_commit(datatype)
end function MPI_Type_commit
MPI_Fint C_MPI_Type_commit(MPI_Fint * f_handle)
{
MPI_Datatype datatype = MPI_Type_f2c(*f_handle);
MPI_Fint ierr = MPI_Type_commit(&datatype);
*f_handle = MPI_Type_c2f(datatype);
return ierr;
}
Impact on Implementations
None. No one depends on this example to implement MPI.
Impact on Users
Users won't be confused into writing bad code.
References and Pull Requests
Programs must not declare names (identifiers), e.g., for variables, functions, constants, types, or macros, beginning with any prefix of the form MPI_, where any of the letters are either upper or lower case.
Programs must not declare names, e.g., for variables, subroutines, functions, parameters, derived types, abstract interfaces, or modules, beginning with the prefix MPI_.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status