[Mpi-forum] Giving up on C11 _Generic
nmm1 at cam.ac.uk
Sun Aug 18 03:56:30 CDT 2019
On Aug 17 2019, Jed Brown via mpi-forum wrote:
I don't want to go over old ground, but I feel these statements need a
bit of balancing.
>They might even build
>using -Wconversion (with a C11 compiler) as a diagnostic to check that
>they have used MPI_Count everywhere that it is needed. But the fallback
>will just rely on silent (default -Wno-conversion) conversion to int,
>thereby preserving today's behavior.
They are unlikely to use -Wconversion, because of the number of false
positives it generates; I fairly often use it, but I have been coding for
and teaching extreme portability for many decades. I also teach the use of
-Wconversion but most people who try it on production codes give up on it.
And, unfortunately, the reasons are inherent in the C language.
The big problem with failure is NOT the direct MPI programmers on their
development systems, but when a working program is ported to a new system,
often by someone else entirely. The danger there is that they are not
expecting a subtle, quiet error that will show up only in very big runs,
NOT most test runs, and may well not realise they are getting wrong answers.
That's seriously bad news and causes a LOT of false information to be
Another is, as I said, C++. Far more codes are developed in C++ than C
nowadays, and I discovered a new issue there when working on something
else. C11 generics cause havoc with C++'s type-matching rules, so including
<cstdlib> and using namespace std (both VERY common) causes any use of the
built-in C++ abs function (at least on double) to fail. This may be a bug
in the compiler, but I don't think so. My guess is that most vendors will
alleviate that by not supporting C11 generics in C++'s C interface.
More information about the mpi-forum