[Mpi-forum] Compile problems with examples in MPI Standard

N.M. Maclaren nmm1 at cam.ac.uk
Tue Jul 24 10:42:05 CDT 2012

On Jul 24 2012, William Gropp wrote:
>Here's the test case for everyone.  No const.
>int MPI_Init( int *argc_p, char *((*argv_p)[]) );
>int main( int argc, char *argv[] )
>     MPI_Init( &argc, &argv );
>     return 0;

Ah.  Yes, that's erroneous.  The type of &argv is 'char ***', though
both of the following should work:

    int MPI_Init( int *argc_p, char ***argv_p );
    int MPI_Init( int *argc_p, char **argv_p[] );

You can add parentheses ad lib, provided that you bind the array
brackets to the name, as in:

    int MPI_Init( int *argc_p, char (*(*(argv_p[]))) );

Nick Maclaren.

More information about the mpi-forum mailing list