[Mpi-22] Ticket #46: Add const Keyword to the C bindings-implementation
Darius Buntinas
buntinas at [hidden]
Wed Mar 18 20:15:25 CDT 2009
I just want to point out that casting away the const for low-level
interfaces is really a non issue. Putting a const on the send buffer
parameter in an MPI function prototype indicates a contract with the
user that the MPI implementation will not change the contents of the
buffer referenced from that function. As long as the MPI implementor
knows that a routine called by the library will not modify the buffer
it's OK to cast away the const. E.g., the POSIX standard tells you that
writev must not change the contents of the buffer, so casting away const
is fine.
Sure, that means that the MPI implementor has to be more careful when
casting away const to ensure that the function being called won't modify
the buffer. But the whole point of the proposal is so that the
_MPI_user_ doesn't need to do this and instead can count on the compiler
to do the check.
-d
More information about the Mpi-22
mailing list