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@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@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@lists.mpi-forum.org
> https://lists.mpi-forum.org/mailman/listinfo/mpi-forum
>
_______________________________________________
mpi-forum mailing list
mpi-forum@lists.mpi-forum.org
https://lists.mpi-forum.org/mailman/listinfo/mpi-forum

Reply via email to