Re: Comment on new INTENT paragraph

Dick Treumann (treumann@kgn.ibm.com)
Tue, 13 May 1997 14:46:23 -0400

Eric Salo wrote:
>

> I think that in general, implementations can assign const arguments
> wherever they please because it does not impact the applications at all.
> Certain arguments would of course be very silly, such as the buffer
> passed to MPI_RECV...
> --
> Eric Salo Silicon Graphics salo@sgi.com

I think your comment would apply to:
int MPI_Recv(void const *bufptr, .....
which says that bufptr is a constant pointer to a void. Since the
pointer is passed by value anyway, the fact that it is const is not news
to the compiler.
int MPI_Recv(const void *bufptr,...
says bufptr is a pointer to a const void. This is clearly incorrect and
any MPI which put this in their function prototype would get lots of bug
reports.

In the case MPI_Start(const MPI_Request *handle) the standard allows an
implementation to modify the handle if it wishes but many will not.
This means that the handle is passed by reference to make the overlay
possible but a prototype using const attribute to indicate a "pointer
to a const MPI_Request" as I indicate is promising the compiler it does
not change the handle even though it has the information it needs to do
so.

Perhaps there would be a value to providing:
int MPI_Send(const void *bufptr,.....
if you have a smart enough C compiler to exploit the extra information.

Dick

I hope I have the const subtleties right here!

-- 
Dick Treumann                               IBM RS/6000 Division
(Internet) treumann@pok.ibm.com             Poughkeepsie, NY
(VNET)     TREUMANN at KGNVMC               Tel: (914) 433-7846
(internal) treumann@windsurf.pok.ibm.com    Fax: (914) 433-8363