&gt; [...] I have a nagging suspicion that virtually every sizable C++ codebase does actually have some undefined behavior lurking somewhere.<p>You are being too optimistic.  Any C++ code base over at most a couple hundred very carefully crafted lines will have undefined behaviour and implementation specified behaviour.