[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[mpi-21] Proposal EH2: add const keyword to the C bindings
[I'm still trying to catch up on all of the e-mail messages before
next week, so please excuse me if this has come up before.]
Here is a way in which adding "const" to the C bindings could break
an existing MPI program. Suppose I write this:
#include <mpi.h>
void foo(void)
{
typedef int (* sendfunc_t)(void *, int, MPI_Datatype, int, int,
MPI_Comm);
sendfunc_t s;
s = MPI_Send;
}
If we re-define MPI_Send() so that its first argument has type "const
void *", then this code becomes incorrect.
This problem notwithstanding, I do believe that Erez's proposal to
add "const" to the bindings has merit. My suspicion is that there
are very few MPI applications that do something like this.
Perhaps the upshot is that we need to get our heads around moving the
standard forward in ways that occasionally break back-compatibility.
Maybe we should come up with a mechanism (e.g. compile with "-
DMPI_2.1" to get the old bindings) that provides a migration path for
codes.
-dg