On Jan 26, 2011, at 8:09 AM CST, Jeff Squyres wrote:
On Jan 25, 2011, at 6:58 PM, Dave Goodell wrote:
I'm wondering if there are really two options here:
1. Have a real casting operating (somewhat akin to Martin's initial proposal): have a casting function that returns the OUT value (vs. an int error code). Then you can nest the output of the casting function as an argument to MPI_Perfvar_handle_allocate(), for example.
2. Have 9 different versions of MPI_Perfvar_handle_allocate() and MPI_Controlvar_handle_allocate() -- one for each MPI handle type.
I assume most people will recoil from #2. But... hmm. It *is* the safest way to go. But ugly (because it's lots of functions). Hmm...
#1 is cute, but it doesn't match MPI error handling conventions, and I'd rather not begin passing the error code back as an OUT arg for just this small set of conversion routines.
MPI_Wtick, MPI_Wtime, and the f2c / c2f routines return their OUT values. Indeed, the f2c / c2f routines could be considered "casting-like" operators.
That's a good point, I always forget about f2c/c2f routines because they are just little integer type casting macros in MPICH2. Maybe it's not quite the departure from convention that I claimed. Actually, I think I'm in favor of #1 if the implementation is allowed to implement them as macros. They'll be no-ops for us, but you can have full functions if you like to add some type checking from the compiler. But if you want to allocate/deallocate memory in the conversion routines in order to create a new generic handle then this system won't work. Is that what you want? Or is a "user comment" cast of the pointer value all that you need? -Dave