[Mpi-forum] Giving up on C11 _Generic

N.M. Maclaren nmm1 at cam.ac.uk
Thu Aug 8 07:56:17 CDT 2019

On Aug 7 2019, Jeff Squyres (jsquyres) via mpi-forum wrote:
> After much debate, the BigCount WG has decided that C11 _Generic just 
> isn't worth it. That's no reason to penalize Fortran, though.

That is certainly the simplest solution.  There may be others, but
see below.

At a wild guess, this is probably trappable by implementations (at some
effort, and needing deep knowledge of the standards and issues) for MPI
being called directly from conforming C compilers, but not from C++ ones
using their C interface.  And that is a very serious gotcha.

On Aug 7 2019, Anthony Skjellum via mpi-forum wrote:
>Conclusion: You can't use non-compliant MPI-4 with C11 compilers that are
>non-compliant with C11, except maybe with a special flag???
>Is there more that I am missing?

It's a LOT more complicated than that, as I tried to explain earlier.

Even when I was most active in this area, it would have taken me many
hours, probably days, of investigation (including on systems to which I
had no access), studying at least the C99, C11, C++ and MPI standards in
great detail, and working out flow-charts, to be fairly sure of the
situation.  This area is a gibbering nightmare, and is a major reason
the UK voted "no" to C99.

On Aug 7 2019, Jeff Hammond via mpi-forum wrote:
>"silently truncated at run time" is trivially addressed with -Wconversion
>or -Wshorten-64-to-32.  The example program below is addressed by this.

Unfortunately, no.  While I have no trouble using such options on MY
code, I have frequently found them unusable on imported packages, because
of the flood of non-errors they generate.  For example, the following
code is both common and reasonable, and includes narrowing conversions:

    int i;
    i = sizeof(double);
    float x;
    x = 1.0;

On Aug 8 2019, Gropp, William D via mpi-forum wrote:

> That -Wall is a lie is also true for gcc. Yes, this is a extremely poor 
> design. If you want to provide -Wmostcommon then do that (and maybe 
> abbreviate to -Wmost).

Agreed, but it's a digression here!  I believe that the gcc people agree,
too, but changing it now is just too evil.

Nick Maclaren.

More information about the mpi-forum mailing list