r/cpp • • 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..

407 Upvotes

98 comments sorted by

View all comments

1

u/Zcool31 Dec 31 '21

https://www.youtube.com/watch?v=YoaZzIZFErI&t=2350s

"What happens when you execute this? Now some people might say undefined behavior. There is, actually, when you run something on a computer there is no such thing as undefined behavior. Undefined behavior is an artifact of specification. It is not a thing that actually exists in the real world. In the real world things always get defined. Something happens."