Comment by flohofwoe
3 years ago
> UB, on the other hand, exists for compiler authors to optimize.
Was this really the original reason why there's UB in the C standard, or has this been retconned by 'malicious compiler authors'? ;)
3 years ago
> UB, on the other hand, exists for compiler authors to optimize.
Was this really the original reason why there's UB in the C standard, or has this been retconned by 'malicious compiler authors'? ;)
It is the original reason. For example, register allocation is possible because stack smashing is UB.
UB is also very much based around software incompatibilities though, not just the ability to optimise stuff.
But where IB can have useful definitions to document, UB was defined so because the behaviours were considered sufficiently divergent that allowing them was useless, and so it was much easier to just forbid them all.