[MPIWG Fortran] Question about named constants

Junchao Zhang jczhang at mcs.anl.gov
Thu Jun 18 11:05:54 CDT 2015


Hello, Fortran experts,
  I am a little puzzled by MPI-3.1 Chapter 2.5.4,

All named constants, with the exceptions noted below for Fortran, can be
used in
initialization expressions or assignments, but not necessarily in array
declarations or as
labels in C switch or Fortran select/case statements.  This implies named
constants
to be link-time but not necessarily compile-time constants.


 Then in F08, should MPI_INTEGER be declared as a parameter variable?  If
no, then I get an error when compiling this initialization expression with
gfortran
          type(MPI_Datatype) :: dtype = MPI_INTEGER

    Error: Parameter 'mpi_integer' at (1) has not been declared or is a
variable, which does not reduce to a constant expression

If yes, then of course I can use MPI_INTEGER in Fortran select/case.

Another question is what is the meaning of "link-time constants". I could
not find in MPI. Does it mean I can use MPI_INTEGER after main before
MPI_Init?

Thank you!

--Junchao Zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpi-forum.org/pipermail/mpiwg-fortran/attachments/20150618/b21498e2/attachment.html>


More information about the mpiwg-fortran mailing list