Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

From: Jeff Squyres (jsquyres_at_[hidden])
Date: 2005-11-29 14:31:17


On Nov 25, 2005, at 5:37 PM, Audet, Martin wrote:

> First the MPI_Offset datatype is defined as a preprocessor macro as
> follow in mpi.h:
>
>    /* Type of MPI_Offset */
>    #define MPI_Offset long long
>
> This generate a syntax error when MPI_Offset is used in C++ for what
> Stroustrup call a value construction (e.g. type ( expr_list ) c.f.
> section 6.2 in The C++ programming language).
>
> The obvious solution is to define MPI_Offset as a typedef as follow:
>
>    /* Type of MPI_Offset */
>    typedef long long MPI_Offset;

It's currently a #define right now for convenience in our configure
script (we just AC_DEFINE it). We can certainly change it over to a
typedef; it takes a little trickery on the Autoconf side of things
because we can't AC_SUBST in there, but there's a workaround for that.

I'll put this in tonight so that it will be in tomorrow's trunk nightly
snapshot.

> The seccond problem is related to the C++ interface: it uses direct
> C-style type cast that remove constness. Since ISO/C++ have the
> const_cast operator especially for this situation, the compiler
> generates TONS of warnings (I use to compile my code with -Wall and
> many other warning activated) and this is really annoying.

Excellent catch. We didn't explicitly test for this case with -Wall
for compiling C++ codes. I'll put this in tonight as well (be sure to
let me know if I miss any).

Many thanks!

-- 
{+} Jeff Squyres
{+} The Open MPI Project
{+} http://www.open-mpi.org/