5 ms·
Both of the alternative do not generate same code though. At least they don't without LTO.
by rfoo 2y ago
Both of the alternative do not generate same code though.
At least they don't without LTO.
- p_l 2y agoThe point of "implementation defined" is that the actual code generated is up to implementation, or in fact whether it even accepts such code.
- rfoo 2y agoSure, I don't disagree. What I mean is, most compilers won't generate a function call or an additional indirect memory access for *(111) = 222;, unlike your spec-compliant alternatives. This is, IMO, the problem. Sometimes we just want a more ergonomic way than inline assembly in a hot loop (and also we'd like to to pretend its portable). The spec does not have an answer to this. So, unless all C compilers in the world actively sabotage this usage (like how Go did to map traversal orders), your spec saying this is "implementation defined" have no impact at all. All C compilers are bound to implement the same intuitive but completely-not-enforced-by-spec behavior. Because if they don't, people just use something else.