Unspecified and Undefined

By Olve Maudal

Strange things can, and will, happen if you break the rules of the language. In C there is a very detailed contract between the programmer and the compiler that you need to understand well. It is sometimes said that upon encountering a contract violation in C, it is legal for the compiler to make nasal demons fly out of your nose. In practice, however, compilers usually do not try to pull pranks on you, but even when trying to do their best they might give you big surprises.

In this talk we will study actual machine code generated by snippets of both legal and illegal C code. We will use these examples while studying and discussing parts of the ISO/IEC 9899 standard (the C standard).