Undefined Behavior - Compiler Easter Eggs

Compiler Easter Eggs

In some languages (including C), even the compiler is not bound to behave in a sensible manner once undefined behavior has been invoked. One instance of undefined behavior acting as an Easter egg is the behavior of early versions of the GCC C compiler when given a program containing the #pragma directive, which has implementation-defined behavior according to the C standard. In practice, many C implementations recognize, for example, #pragma once as a rough equivalent of #include guards — but GCC 1.17, upon finding a #pragma directive, would instead attempt to launch commonly distributed Unix games such as NetHack and Rogue, or start Emacs running a simulation of the Towers of Hanoi.

Read more about this topic:  Undefined Behavior

Famous quotes containing the words easter and/or eggs:

    Why wont they let a year die without bringing in a new one on the instant, cant they use birth control on time? I want an interregnum. The stupid years patter on with unrelenting feet, never stopping—rising to little monotonous peaks in our imaginations at festivals like New Year’s and Easter and Christmas—But, goodness, why need they do it?
    John Dos Passos (1896–1970)

    One of our defects as a nation is a tendency to use what have been called “weasel words.” When a weasel sucks eggs the meat is sucked out of the egg. If you use a “weasel word” after another there is nothing left of the other.
    Theodore Roosevelt (1858–1919)