[Mpi-forum] C++ issues

N.M. Maclaren nmm1 at cam.ac.uk
Fri Jun 29 07:52:00 CDT 2012


On Jun 29 2012, Jeff Squyres wrote:
>>
>> I don't think that I did, but it is a real issue. It is undefined 
>> behaviour of the worst kind to throw a C++ exception where there is a 
>> Fortran procedure in the call chain between the throw and the catch, and 
>> undefined behaviour of a seriously nasty kind when there is a C one.
>
> So are you saying that even MPI::ERRORS_THROW_EXCEPTIONS was a bad idea? 
> (Given that most [all?] MPI implementations are written in C)

No.  The point there is that (as with the Fortran), the implementation
code has to follow the conventions of the interface language, which may
or may not involve some arcane hacking.  I was referring specifically to
user code in the call chain.

> If we keep some form of MPI*ERRORS_THROW_EXCEPTIONS, perhaps we should 
> add some possibility of it not being usable (e.g., for configurations 
> where you can't safely throw a C++ exception through intermediate C 
> code), like making MPI_ERRORS_THROW_EXCEPTIONS == MPI_ERRHANDLER_NULL, or 
> some such...?

Agreed.  And the specification should state that it is implementation-
dependent.  Personally, given the decision to drop C++, I would take a
very hard line on this C++-only facility.  It's certainly the cleanest
and easiest solution.


Regards,
Nick Maclaren.






More information about the mpi-forum mailing list