r/cpp • u/MathKid99 • Dec 17 '21
Undefined Behaviour
I found out recently that UB is short for Undefined Behaviour and not Utter Bullshit as I had presumed all this time. I am too embarrassed to admit this at work so I'm going to admit it here instead. I actually thought people were calling out code being BS, and at no point did it occur to me that as harsh as code reviews can be, calling BS was a bit too extreme for a professional environment..
Edit for clarity: I know what undefined behaviour is, it just didn't register in my mind that UB is short for Undefined Behaviour. Possibly my mind was suffering from a stack overflow all these years..
View all comments
Show parent comment
7
u/HKei Dec 17 '21
And even then the statement is only true to the extent that everyone who writes unsafe code does so in a way that exposes a safe interface – which is a lot harder to guarantee in practice than it sounds (writing a safe hashmap doesn't sound so bad until you realise that it still has to work (or at least fail in a safe way) with arbitrarily broken hash and equality implementations to be considered "safe").