3 ms·
The C language standard makes certain guarantees, such as no out-of-bounds array access, or no modification of memory accessed through a restrict-qualified expr
by cygx 7y ago
The C language standard makes certain guarantees, such as no out-of-bounds array access, or no modification of memory accessed through a restrict-qualified expression by other means.
If such things happen during program execution, the program does not conform to the standard, and its runtime behaviour becomes undefined.
This is exactly the same situation you have with Fortran, which makes certain guarantees about, say, the aliasing of function arguments. If all such cases could be detected ahead of time, it would be impossible for programmers to write non-conforming programs. This is not possible.
I repeat, there is no essential difference between the Fortran and C situation. The best one could argue is that given that the Fortran guarantees are universal (instead of limited to restrict-qualified pointers), a Fortran programmer is less likely to write an incorrect program, but that's it.
- pjmlp 7y agoI guess we have different ways to interpret ISO standards documents, so let's leave at it.