Open MPI logo

Open MPI Development Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Development mailing list

Subject: Re: [OMPI devel] predefined ompi_t types break strict-aliasing rules
From: Number Cruncher (number.cruncher_at_[hidden])
Date: 2009-04-24 09:19:00


Christian Siebert wrote:
> Hi Number Cruncher,
>
>> With, or without, C++ bindings, I'm getting serious warnings when
>> compiling *any* C++ program which #includes <mpi.h>: <snip>
>
> that's one of the many reasons why the C++ bindings will very likely be
> removed in the next version of the MPI standard. If you really rely on
> C++ then you might try sth. like the Boost C++ Libraries ...
>
> Christian
>
>

Indeed boost::mpi is really good and I am using it, but it won't help
here. But my problem exists ***without*** the C++ bindings. It should be
possible for my C++ code to call the MPI C standard API without such
warnings!

It's fundamentally wrong to expect a C++ compiler to alias a
"ompi_predefined_communicator_t *" to a "ompi_communicator_t *" unless
it has the full definition of such types available. I'm not an expert,
but I think the C standard is a bit more lax here.

The bottom line is that spotting aliasing from types is a good thing and
gives C++ better optimisation opportunities (e.g. Fortran has no
aliasing). See http://en.wikipedia.org/wiki/Aliasing_(computing) for a
decent discussion.

Simon.