[Mpi-forum] Giving up on C11 _Generic

2019-08-07 Thread Jeff Squyres (jsquyres) via mpi-forum
SHORT VERSION = Due to the possibility of silently introducing errors into user applications, the BigCount WG no longer thinks that C11 _Generic is a good idea. We are therefore dropping that from our proposal. The new proposal will therefore essentially just be the addition of a

Re: [Mpi-forum] Giving up on C11 _Generic

2019-08-07 Thread Anthony Skjellum via mpi-forum
Jeff, I don't think we all agree 100% to abandon C11 _Generic, and let me feedback to you what you write below for further argumentation; I am a bit surprised this is in front of the whole forum just one day after WG discussions, when more WG discussions are still in order weeks before the

Re: [Mpi-forum] Giving up on C11 _Generic

2019-08-07 Thread Jim Dinan via mpi-forum
This example is a bit more representative of how we would use this to implement the MPI bindings (renamed "bar" macro to "foo" and shifted down to enable the name aliasing): #include static void foo(int j) { printf("foo(j) = %d\n", j); } #define foo(j) foo(sizeof(j) > sizeof(int) ? -1

Re: [Mpi-forum] Giving up on C11 _Generic

2019-08-07 Thread Jim Dinan via mpi-forum
Jeff, You can wrap the function in a macro that checks for truncation: #include #define bar(j) foo(sizeof(j) > sizeof(int) ? -1 : j) static void foo(int j) { printf("foo(j) = %d\n", j); } int main(int argc, char *argv[]) { /* 8589934592LL == 2^33 */ long long i =

Re: [Mpi-forum] Giving up on C11 _Generic

2019-08-07 Thread Jeff Hammond via mpi-forum
I don't care that much about C11 _Generic, which is why I have always focused on a C99 solution to the large-count problem, but I disagree with your reasons for abandoning it. "silently truncated at run time" is trivially addressed with -Wconversion or -Wshorten-64-to-32. The example program

Re: [Mpi-forum] Giving up on C11 _Generic

2019-08-07 Thread Jim Dinan via mpi-forum
Even simpler than this, we could just forward all calls to the MPI_Count interface (see below). The int count argument should type convert to MPI_Count without issue. Note that it still needs to be a function-like macro so that function pointers work. Don't give up yet! :D ~Jim. #include

Re: [Mpi-forum] Giving up on C11 _Generic

2019-08-07 Thread Jeff Hammond via mpi-forum
You can't do that forwarding for vectors of counts. On Wed, Aug 7, 2019 at 2:10 PM Jim Dinan via mpi-forum < mpi-forum@lists.mpi-forum.org> wrote: > Even simpler than this, we could just forward all calls to the MPI_Count > interface (see below). The int count argument should type convert to >

Re: [Mpi-forum] Giving up on C11 _Generic

2019-08-07 Thread Jim Dinan via mpi-forum
That case should not have the implicit type conversion issue that Joseph raised and should be fine without the extra macro when _Generic is unsupported. On Wed, Aug 7, 2019, 5:43 PM Jeff Hammond wrote: > You can't do that forwarding for vectors of counts. > > On Wed, Aug 7, 2019 at 2:10 PM Jim