UB or not UB: How gcc and clang handle statically known undefined behaviour
Recently, we had a discussion in our team about undefined behaviour
(UB) in C. For those unfamiliar: We say that a program has undefined
behaviour when we write code where the language specification doesn't
define what should happen during execution. That means compilers can do
whatever they like if they encounter such code and there is no
guarantee that execution will behave in a predictable way. Thus,
undefined behaviour must be avoided at all cost as it not only makes
programs misbehave but i...
Read more at diekmann.uk