Re: Chapter 7

(no name) (Andrew.Lumsdaine@nd.edu)
Thu, 23 May 1996 08:55:08 -0500 (EST)

In our last exciting episode James Cownie wrote:

> I think this is pointing out a fundamental issue. You're presuming
> that the C++ MPI_Comm is a different object from the C MPI_Comm (and
> so on). Why ?

My understanding of the MPI standard is that it does not specify
exactly what an MPI handle is. In particular, I believe that it does
not specify for the C bindings that the handles must be pointers to
structures. The IBM implementation, for instance, uses integers for
its handles. The C++ bindings on the other hand, do (seek to) mandate
the use of references to objects as the handles.

> Therefore I would have expected the C++ MPI_Comm to be exactly the
> same as the C MPI_Comm, but with a whole set of non-virtual member
> functions defined on it. Most of these would then look something like

> int MPI_Comm::Send(void* buf, int count, MPI_Datatype &datatype,
> int dest, int tag)
> {
> return MPI_Send(buf, count, datatype, dest, tag, this);
> }

> The inter-operability and name clash problems then disappear, and
> implementing the C++ binding becomes rather easy...

I agree that this would be a very elegant solution to the
inter-operability problem. However, given that it does not seem to be
possible to require that the C and C++ data types be the same, I think
our problems with name clashing remain.

Moreover, for reasons of "design for inheritance" I think it is
desirable to have the member functions of the C++ objects to be
virtual. This would break the equivalence between the C struct and
the C++ object at any rate.

--------------------------------------------------------------------
Andrew Lumsdaine
Dept. Comp. Sci. & Engr. email: Andrew.Lumsdaine@nd.edu
353 Fitzpatrick Hall phone: (219) 631-8716
University of Notre Dame fax: (219) 631-9260
Notre Dame, IN 46556
--------------------------------------------------------------------