Attention people who think UB is fine

31 points by abareplace


olliej

Seriously. People need to stop thinking UB is about allowing different behavior.

It is absolutely not. No amount of arguing changes this.

UB is not implementation defined behavior. That term already exists.

UB places no constraints on the compiler. If the standard does not define the result of doing X in condition Y is undefined, or it just does not define the result (either explicitly, ID, unspecified, or erroneous), then there are no constraints on the compiler.

It does not matter what your implementation, platform, or hardware do. If the behavior is UB according to the language, the compiler can do anything, or nothing, or different things in different places. If the language says it is UB, it is UB.

If you want different implementations to be able to provide different behavior, you want implementation defined behavior. That is literally why ID exists separately from UB.