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

William Gropp wgropp at illinois.edu
Tue Jul 24 11:21:08 CDT 2012


Thanks.

Clearly, we need to change the prototype for MPI_Init and MPI_Init_thread.  The best choice is probably back to the original:

char ***argv_p

since that's what it is (complete with a rationale for why it isn't what we're currently using).  I prefer this to the char (*(*(argv_p[]))), since the usual inside-out reading of that is "argv_p is an array of pointers to pointers", which isn't the intent, though it might make the compiler happy.  

Bill

William Gropp
Director, Parallel Computing Institute
Deputy Director for Research
Institute for Advanced Computing Applications and Technologies
Paul and Cynthia Saylor Professor of Computer Science
University of Illinois Urbana-Champaign



On Jul 24, 2012, at 10:42 AM, N.M. Maclaren wrote:

> 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[]))) );
> 
> Regards,
> Nick Maclaren.
> 
> 
> _______________________________________________
> mpi-forum mailing list
> mpi-forum at lists.mpi-forum.org
> http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi-forum





More information about the mpi-forum mailing list