LAM/MPI logo

LAM/MPI General User's Mailing List Archives

  |   Home   |   Download   |   Documentation   |   FAQ   |   all just in this list

From: hedman_at_[hidden]
Date: 2004-09-28 04:37:51


Inspired by another conversation on the list I started
thinking about what could be done with the C++ interface.
So reading the C++ header files of lam-mpi I find that there
is in fact no virtual dtor defined for MPI::Intercomm; it is
commented out. To my knowledege this means that deleting a
class derived from MPI::Intercomm through a pointer to
e.g. Comm will result in undefined behaviour. Am I missing
something here, or?

   // From mpi2cxx/comm.h
   //
   class Comm_Null {
   public:
     // construction
     inline Comm_Null() : mpi_comm(MPI_COMM_NULL) { }
     // copy
     inline Comm_Null(const Comm_Null& data) : mpi_comm(data.mpi_comm) { }
     // inter-language operability
     inline Comm_Null(const MPI_Comm& data) : mpi_comm(data) { }

     // destruction
     //JGS virtual inline ~Comm_Null() { }
     //
     // [ ... ]
     //
   };

   class Comm : public Comm_Null {
   public:
     //
     // [ ... ]
     //
     // construction
     Comm() { }

     // copy
     Comm(const Comm_Null& data) : Comm_Null(data) { }
     //
     // [ ... ]
     //
   };

   // From: mpi2cxx/intercomm.h
   //
   class Intercomm : public Comm {
   public:
     // construction
     Intercomm() : Comm(MPI_COMM_NULL) { }
     // copy
     Intercomm(const Comm_Null& data) : Comm(data) { }
     // inter-language operability
     Intercomm(const MPI_Comm& data) : Comm(data) { }
     //
     // No dtor ~Intercomm() defined!?
     //

     //
     // [ ... ]
     //
   };

--
F.