Superb discussion of the many types of UB in C/C++ and how to deal with them:
https://blog.regehr.org/archives/1520
(infinite loops is my fav oddball UB)
Program synthesis is just magical. The next version of https://github.com/Wilfred/suggest.el will support nested functions. E.g. searching 0 => 3 here.