[Mpi-forum] C++ types inaccessible after #281
jedbrown at mcs.anl.gov
Wed Jun 27 15:53:47 CDT 2012
On Wed, Jun 27, 2012 at 11:59 AM, N.M. Maclaren <nmm1 at cam.ac.uk> wrote:
> It's not the compiler that is the issue, because MPI needs only the C
> facilities that are available in the C subset of C++.
But C (90 or otherwise) isn't a subset of C++, though I don't see it being
> It's what is defined
> in the various standards.
> I was hoping to get time to respond in a more carefully thought-out
> but am in a WG5 meeting, so this is in haste.
> Using C99 is NOT a solution, largely because the requirement is for use
> from C++ and std::complex and std::bool do not have equivalents in C99
> (_Complex ,and _Bool are semantically different, and are not required to
> match those.
So in C++ sizeof(bool) is not required to be 1. It's not clear to me
whether the integer rank inequalities in C99 require it to be equal to 1
(like char). In either case, there is no guarantee that these have the same
size, thus we seem to need a MPI_CXX_BOOL for completeness (though no
science will ever be impeded by lack of support for bool).
It is certainly the case that C99 _Complex has the same data representation
as the corresponding std::complex type, cf. C99 126.96.36.199 and C++11 26.4
paragraph 4. Note that MPI does not care about differences in conversion
semantics that account for the most commonly encountered incompatibilities
between C99 and C++ types.
> Also, the required language is C90, because C++03 inherits
> from it, and C99 has been rejected (for VERY good reasons) by about half
> of the C-using communities.
> While C++11 nominally inherits from C99, it has not included _Complex or
> _Bool, and has kept a lot of C90 semantics in cases where C99 and C90 are
> incompatible. Most of those don't affect this, but one aspect does.
> Someone mentioned that C99 _Complex has better semantics than std::complex.
> I am afraid that is the converse of the truth, especially when you bring
> in the utterly appalling Annex G.
What is the problem with Annex G (which is not normative)? C++ doesn't
specify anything in particular, nor even suggest that division ought to be
implemented in a stable way.
> C++11 has included the function calls
> for IEEE 754 support, but neither the pragmas nor the semantics, and the
> combination is therefore totally undefined.
Sure, so C99 semantics conform to C++ requirements because C++ doesn't
bother specifying anything.
> Yes, this is an ungodly mess. I don't agree with the forum's decision,
> but let's accept it. The only reasonable approach is the one of having
> MPI types for C++'s types, which could still be used via the C interface
> from a C++ compiler. I believe that is what you were referring to, and
> what is intended.
As in my first email, I think that MPI_CXX_COMPLEX et al should be defined,
but I haven't seen anything to indicate that an implementation would not be
able to simply make them aliases to MPI_C_COMPLEX.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the mpi-forum