Hacker News new | ask | show | jobs
by jhomedall 3504 days ago
I know exactly how it will behave in most of those scenarios.

Right up until an optimizing compiler throws your assumptions under the bus.

Compilers are allowed to (and both GCC and Clang frequently do) assume that your program will never invoke undefined behavior, and optimize accordingly.

See: http://blog.llvm.org/2011/05/what-every-c-programmer-should-... Also maybe: http://blog.regehr.org/archives/1307

This can lead to some pretty bad security flaws: https://lwn.net/Articles/575563/