[Mpi-forum] Reserved MPI_ prefix & namespace in C and Fortran
N.M. Maclaren
nmm1 at cam.ac.uk
Fri Aug 24 12:03:07 CDT 2012
On Aug 24 2012, William Gropp wrote:
>
> The intent of the Forum has always been that all names that begin with
> MPI_ or PMPI_, and the MPI namespace, are reserved for MPI. The mistake
> (a common one) was to attempt to enumerate all of the items to which this
> applies. Rather than attempt to cover everything, I would prefer changing
> the text to match the indent; it can mention specific categories as
> examples but should not attempt to list them, as this is always error
> prone.
While I think that is correct, I am afraid that the wording isn't, for
any of the languages.
If C++ is deleted, then the reference to namespaces should be, too;
while C has such a concept, it's wildly different, and you don't want
to go there :-) If it isn't, it should be explicitly the namespaces
MPI and PMPI, as at present.
>> The solution is very simple, an MPI-2 errata ticket changing
>> MPI-2.2, lines 15-16 into (addition marked with {...}):
>>
>> "Programs must not declare variables, functions,
>> { constants, macros, types, or namespaces }
>> with names beginning with the prefix MPI_."
The killer is that is both too restrictive and too lax - you also have
labels, tags and members (C99 6.2.3), and local names are a problem
onbly together with the header.
>> And for Fortran on p17:41-42 (addition marked with {...}):
>>
>> "Programs must not declare variables, parameters, functions,
>> { derived types, or abstract interfaces }
>> with names beginning with the prefix MPI_.
The same applies, in very different ways. Fortran has a vast number
of other classes of name, but declaring local ones will cause trouble
only in combination with the header.
Better wording might be, for C:
Other than by including the header "mpi.h", programs shall not
declare entities with external names beginning with the prefix
MPI_. In a translation unit that includes the header "mpi.h",
programs shall not declare any other entities with names
beginning with the prefix MPI_.
And for Fortran:
Other than by using one of the modules "mpi_f08" or "mpi" or
including the header "mpif.h", programs shall not declare
entities with external names beginning with the prefix MPI_.
In a program unit that uses one of the modules "mpi_f08" or "mpi"
or includes the header "mpif.h", programs shall not declare any
other entities with names beginning with the prefix MPI_.
Regards,
Nick Maclaren.
More information about the mpi-forum
mailing list