|
|
|
|
|
by mpweiher
3688 days ago
|
|
> Your interpretation of "codify common existing practice" would imply that no new compiler optimizations could be implemented since 1990 Utter nonsense. I use that word carefully, but in this case it is absolutely appropriate. Compiler optimisations per an old but very useful definition aren't allowed to change the visible behaviour of programs (in terms of output, obviously they are allowed to change execution times). For example, even just a couple of years ago the compilers I used would execute a loop that sums the first n integers. Nowadays compilers detect this and replace the loop with the result. While this isn't particularly useful, because probably the only reason you're summing the first n integers in a loop is to do some measurements, it is (a) a perfectly legal optimisation and (b) happened after 1990. Unsurprisingly, you left out the second part of the (later) definition: NOTE Possible undefined behavior ranges from ignoring the situation completely with unpredictable
results, to behaving during translation or program execution in a documented manner characteristic of the
environment (with or without the issuance of a diagnostic message), to terminating a translation or
execution (with the issuance of a diagnostic message).
Notably absent is "use the undefined behaviour to shave another 0.2% off my favourite benchmark". |
|
It is not part of the normative definition, which says "for which this International Standard imposes no requirements". In ISO standards, notes are without exception non-normative.
Although I think they really should add your proposed text as an additional example, as their current set of examples is evidently confusingly incomplete :-)