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:

    In your Easter bonnet, with all the frills upon it,
    You’ll be the grandest lady in the Easter parade.
    Irving Berlin (1888–1989)

    The common cormorant or shag
    Lays eggs inside a paper bag.
    Christopher Isherwood (1904–1986)