On 3/21/23 19:03, Paul Koning via Gcc-patches wrote:
Failure to understand the language is a common problem and we do try to emit
various diagnostics to help developers avoid writing non-conformant code. But
ultimately if a developer fails to understand the language standard, then
they're going to be surprised by the behavior of their code.
Conversely, of course, the problem is that C and other languages have evolved
to the point that you have to be a language lawyer to write valid code. In
other words, a substantial fraction of programmers are by definition writing
unreliable code. This is not a good situation, and it may be part of the
reason why modern software has such a high rate of defects.
Fortran compilers that I use regularly (I mean, aside from gfortran)
have already given up on this battle, at least as far as floating point
issues are concerned.
So many people want to have "repeatable floating point computations"
that if someone writes:
READ*, X, Y, Z
PRINT*, X + Y + Z
END
they will get (if they know the compiler option that guarantees this -
but they will) the following code:
READ*, X, Y, Z
PRINT*, (X + Y) + Z
END
even though there's no way in hell the Fortran Language Standard (any of
them) guarantees this.
--
Toon Moene - e-mail: t...@moene.org - phone: +31 346 214290
Saturnushof 14, 3738 XG Maartensdijk, The Netherlands