4 ms·
Some actionable takeaways about the abstract machine and undefined behavior of the standard. * Just because something is undefined in the standard now, it does
by planede 4y ago
Some actionable takeaways about the abstract machine and undefined behavior of the standard.
* Just because something is undefined in the standard now, it does not mean that it has to be undefined forever. It might be an oversight, or priorities might shift. If you disagree with a particular undefined behavior and about ways how it can manifest you can raise it with the committee and/or compiler vendor.
* The behavior of a program is just as defined by the implementation now than before a standard existed. If you write code that contains operations where the standard does not define behavior, the implementation might (but they don't have to). Consult your implementation for the compilers you care about. They have flags to enable certain extensions that define the behavior of some operations, at the expense of disabling some optimizations.
- yencabulator 4y agoThe standard doesn't even need to change. The compilers can just stop interpreting the rules around UB with malicious compliance for the sake of 0.1% optimization in some other scenario.