0xDEADBEEF

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Quarl (talk | contribs) at 08:19, 16 December 2006 (Tagged as {{mergeto|hexspeak}}). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

0xDEADBEEF is a number written in hexadecimal notation, with the decimal value of 3735928559, which reads as the phrase "dead beef" in English.

Hexadecimal notation is often used to display or transcribe values stored in computer memory. Most numbers, when displayed in hexadecimal, are uninteresting and not eyecatching. Sometimes, however, a sentinel value is desired that will be easily recognizable when displayed in hexadecimal (for instance, during debugging, or in a log file) yet are unlikely to occur in normal operation of the program. 0xDEADBEEF is sometimes chosen as such a sentinel value so that programmers can recognize this value during programming or debugging. It has no specific meaning, and another recognizable number, such as 0xABABABAB or 0xCAFEFEED, would suffice.

Since it is unlikely that any given 32-bit integer would take this specific value (one chance out of 2^32=4294967296), programmers often use this magic value to investigate common errors such as buffer overflows, or uninitialized variables, when using a debugger. For instance, whenever this value appears in a memory dump, its location is likely to be a point of interest for the programmer. Another example of its possible usage is to initialize various memory locations which programs are not supposed to access, making it easier to detect invalid code execution.

Many versions of the 32-bit PowerPC processors initialize their general purpose registers with a value of "0xDEADBEEF" during reset; this has aided in the debugging of bootloader and kernel crashes during early boot, since registers which have never been written to will retain the value.

0xDEADBEEF was used in the original Mac OS operating systems, and perhaps more notably in the IBM RS/6000 series.

See also

  • Magic number (programming), for a full discussion of magic numbers' usefulness, as well as example of other well-known magic numbers.
  • Hexspeak, for the phenomenon in general.

External links