[Mpi-22] MPI::Grequest::Start proposal
Erez Haba
erezh at [hidden]
Thu Sep 4 03:02:17 CDT 2008
I think that this is okay; when we discussed it, I thought it was a different fix. The proposal is just fine.
-----Original Message-----
From: mpi-22-bounces_at_[hidden] [mailto:mpi-22-bounces_at_[hidden]] On Behalf Of Jeff Squyres
Sent: Thursday, September 04, 2008 7:26 AM
To: MPI 2.2
Subject: [Mpi-22] MPI::Grequest::Start proposal
Regarding https://svn.mpi-forum.org/trac/mpi-forum-web/wiki/mpi22/GrequestStartFnPtrArgs
:
I have confirmed in Open MPI that if you change this:
static Grequest Start(Query_function, Free_function,
Cancel_function, void *);
to
static Grequest Start(Query_function *, Free_function *,
Cancel_function *, void *);
Recompile and reinstall, both the implementation and same C++ user
code compiles without warning/error.
Erez raised the point that this would change the type of any
implementation and user-declared variables that hold the function
pointer. It does not; such a variable type must always be
(Free_function*); it's only the type that is passed through a function
argument that can be either (Free_function) or (Free_function*).
Someone smarter than me in C++ can explain why. :-)
Specifically, the following compiles and runs without warning/error:
-----
#include <stdio.h>
typedef int Free_function(void *);
int my_function(void*) {
printf("In my_function\n");
return 0;
}
void foo1(Free_function ptr) {
Free_function *save = ptr;
save(0);
}
void foo2(Free_function* ptr) {
Free_function *save = ptr;
save(0);
}
int main (int argc, char*argv[]) {
foo1(my_function);
foo2(my_function);
return 0;
}
-----
I tried 4 different C++ compilers (gnu, intel, pgi, pathscale):
-----
[23:19] svbu-mpi:~/tmp % g++ foo.cc -o foo && ./foo
In my_function
In my_function
[23:21] svbu-mpi:~/tmp % icpc foo.cc -o foo && ./foo
In my_function
In my_function
[23:21] svbu-mpi:~/tmp % pgCC foo.cc -o foo && ./foo
In my_function
In my_function
[23:22] svbu-mpi:~/tmp % pathCC foo.cc -o foo && ./foo
In my_function
In my_function
[23:22] svbu-mpi:~/tmp %
------
So I think the proposal stands as it is written.
--
Jeff Squyres
Cisco Systems
_______________________________________________
mpi-22 mailing list
mpi-22_at_[hidden]
http://lists.mpi-forum.org/mailman/listinfo.cgi/mpi-22
More information about the Mpi-22
mailing list