From: Douglas Gregor Date: January 14, 2008 8:35:12 AM CST To: mpi-21@XXXXXXXXXXXXX Subject: Re: [mpi-21] Proposal EH2: add const keyword to the C bindings Reply-To: mpi-21@XXXXXXXXXXXXX On Fri, 2008-01-11 at 16:58 -0500, David Gingold wrote: > [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 > > 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. Just for reference, the C++ standard itself does not consider the description of function signatures in the standard library to be exact. C++ standard library implementations are permitted to add extra, defaulted parameters to library functions, for example. So, if a program takes the address of a C++ standard library function, it isn't guaranteed what the type of that function pointer will be. I mention this because your example is holding MPI implementations to a higher level of consistency than is expected of the standard libraries shipped with one of MPI's underlying languages. Perhaps we don't want to guarantee so much. - Doug