[Mpi-forum] Preprocessor Constants

Hal Finkel hal.finkel at yale.edu
Sat Nov 20 18:14:11 CST 2010


On Fri, 2010-11-19 at 17:11 +0000, N.M. Maclaren wrote:
> On Nov 19 2010, Hal Finkel wrote:
> >
> >> >User code may assume that mpi.h is unavailable to the preprocessor
> >> >unless the preprocessor constant _MPI is defined prior to source-file
> >> >processing.
> >> 
> >> With one reading of the C standard, that breaks conformance; with 
> >> another, it is recommended practice.
> >
> >I'm not sure what you mean by "breaks conformance." ...
> 
> It's all about the interpretation of the word "reserved" - reserved for
> use by whom?  Future standards?  Implementors (which means of the compiler)?
> Or compiler extensions (which is what MPI is)?
> 

The current C standard (I've copied from WG14/N1256 which is C99 +
TC[1-3]) section on "Predefined macro names" (6.10.8) states, "Any other
predefined macro names shall begin with a leading underscore followed by
an uppercase letter or a second underscore." Although not specifically
qualified, the rest of the section is discussing macros "defined by the
implementation".

"implementation" is defined as (3.13), "particular set of software,
running in a particular translation environment under particular control
options, that performs translation of programs for, and supports
execution of functions in, a particular execution environment." So I
think that MPI could certainly be considered as part of the
implementation; I think the MPI implementation "supports execution of
functions in a particular execution environment."

> I wouldn't worry too much about it, in this case, but it IS worth being
> careful in general.  It has caused trouble.
> 

I agree.

Sincerely,
Hal

> 
> Regards,
> Nick Maclaren.
> 
> _______________________________________________
> mpi-forum mailing list
> mpi-forum at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi-forum





More information about the mpi-forum mailing list