Re:Tell HN: C Experts Panel – Ask us anything about C
by flatfinger on Wednesday April 15, 2020 @10:08AM
(#22877824)
The problem is that under modern interpretation, even if some parts of the Standard and a platform's documentation would define the behavior of some action, the fact that some part of the Standard would regards an overlapping category of constructs as invoking UB overrides everything else.
Re:Tell HN: C Experts Panel – Ask us anything about C
by AaronBallman on Wednesday April 15, 2020 @03:52PM
(#22882241)
I could imagine misguided readings of some coding standard advice that would lead to that interpretation, but it's still not an interpretation that makes sense to me.
Implementations define undefined behavior all the time and users rely on it. For instance, POSIX defines that you can convert an object pointer into a function pointer (for dlsym to work), or implementations often rely on offsets from a null pointer for their 'offsetof' macro implementation.
Re:Tell HN: C Experts Panel – Ask us anything about C
by flatfinger on Thursday April 16, 2020 @11:18AM
(#22890261)
Such an interpretation would be the only way to justify the way the maintainers of clang and gcc actually behave in response to complaints about their compilers' "optimizations".
You're exactly right that this is why there is a distinction between conforming and strictly conforming code.