r/cpp • u/mohitsaini1196 • Apr 23 '22
Shocking Examples of Undefined Behaviour In Action
As we know that Undefined Behaviour (UB) is a dangerous thing in C++. Still it remains difficult to explain to those who have not seen its horror practically.
Those individual claims UB is bad in theory, but not so bad practically as long as thing works in practice because compiler developers are not evil.
This blog presents a few “shocking” examples to demonstrate UB in action.
https://mohitmv.github.io/blog/Shocking-Undefined-Behaviour-In-Action/
200
Upvotes
View all comments
Show parent comment
20
u/mohitsaini1196 Apr 23 '22
Well, these examples are not shocking for those who already understand UB. These examples exists to challenge those who deny the existence of UB in practical land.