[Mpi-forum] Giving up on C11 _Generic

Jim Dinan james.dinan at gmail.com
Thu Aug 8 09:37:42 CDT 2019


In fairness, unsafe conversions are a feature of the C language, I assume
since very early on.  Assignment gets a pass to do horribly unsafe
conversions.  Unfortunately, when calling a function (with a prototype),
the argument expressions are converted as if by assignment, which is the
underlying cause for the truncation sadness.

 ~Jim.

On Thu, Aug 8, 2019 at 9:45 AM Jeff Hammond via mpi-forum <
mpi-forum at lists.mpi-forum.org> wrote:

> That you use code that does unsafe conversions really has nothing to do
> with the business of the MPI Forum.
>
> Again, if you think C89 is the best C, then use and teach that. No one
> here is trying to make you use C11.
>
> Jeff
>
> > On Aug 8, 2019, at 5:56 AM, N.M. Maclaren via mpi-forum <
> mpi-forum at lists.mpi-forum.org> wrote:
> >
> >> 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;
> _______________________________________________
> mpi-forum mailing list
> mpi-forum at lists.mpi-forum.org
> https://lists.mpi-forum.org/mailman/listinfo/mpi-forum
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mpi-forum.org/pipermail/mpi-forum/attachments/20190808/28189fdb/attachment.html>


More information about the mpi-forum mailing list