4 ms·
> all the undefined behaviour added for high performance computing UBs were added for cross-incompatibilities, where operations were too "core" (and / or untes
by masklinn 4y ago
> all the undefined behaviour added for high performance computing
UBs were added for cross-incompatibilities, where operations were too "core" (and / or untestable) for IBs to be acceptable. The reason was not performance (aside from not imposing a runtime check where that would have been possible) but portability:
> 3.4.3 undefined behavior behavior, upon use of a nonportable or erroneous program construct or of erroneous data, for which this International Standard imposes no requirements
Those UBs were leveraged later on by optimising compilers, because they provide constraints compensating for C's useless type system.
So you can just use a non-optimising compiler or one which only does simple optimisations (e.g. tcc), and see what the compiler generates from your UBs.
- tsimionescu 4y agoThe standard also has implementation-defined behavior, doesn't it?
- masklinn 4y agoTheir existence is mentioned in my comment so I am not sure what you are trying to say.