133 upvotes
What does the word "dead beef" mean? I read it from a interview question.
It has something to do with ipv6.
I figured it could be a random hex number used for examples, like "The quick brown fox jumps over the lazy dog".
Is my understanding correct? Or it has more significant meaning?
edited Feb 15, 2018 at 14:12 NikxDa
answered May 25, 2010 at 18:10 Dustin Laine
94 upvotes
The value of 0xDEADBEEF has three practical benefits, mostly for older systems.
Old assembler/C hacks, like me, would use it to fill unallocated memory to coax out memory issues.
Also, it's a pun of the slang term "dead meat". The programmer is dead meat if DEADBEEF winds up in his pointers.
I congratulate the guy who first thought of using the value DEADBEEF. It's clever in many ways.
As for practical reasons, firstly, it's more noticeable in a hex memory dump because it actually spells words as opposed to random hex values.
Secondly, if the value winds up in a pointer, it's more likely to induce a memory out-of-range fault.
An address of DEADBEEF was out of the address range of systems (we're talking last century systems now) regardless of the system's endian.
Thirdly, it is more likely to induce a fault on systems that require even boundary pointer values for accessing 16/32/64-bit data.
The value is more likely to fault because both of the 16 bit values (DEAD, BEEF) are odd.
edited Feb 9, 2016 at 11:21
answered May 25, 2010 at 20:25 BSalita
59 upvotes
It's a made up expression using only the letters A-F, often used when a recognisable hexadecimal number is required.
Some systems use it for various purposes such as showing memory which has been freed and should not be referenced again.
In a debugger this value showing up could be a sign that you have made an error. From Wikipedia:
0xDEADBEEF ("dead beef") is used by IBM RS/6000 systems, Mac OS on 32-bit PowerPC processors and the Commodore Amiga as a magic debug value.
On Sun Microsystems' Solaris, it marks freed kernel memory. On OpenVMS running on Alpha processors, DEAD_BEEF can be seen by pressing CTRL-T.
The number 0xDEADBEEF is equal to the less recognisable decimal number 3735928559 (unsigned) or -559038737 (signed).
answered May 25, 2010 at 18:11 Mark Byers
26 upvotes
Since IPv6-Adresses are written in Hex-notation you can use "Hexspeak" (numbers 0-9 and letters a-f) in Adresses.
There are a number of words you can use as valid adresses to better momorize them.
If you ping6 www.facebook.com -n you will get something like "2a03:2880:f01c:601:face:b00c:0:1".
Here are some examples:
edited Feb 15, 2018 at 13:25
answered Jul 11, 2014 at 16:56 Martin Seitl
15 upvotes
It is also used for debugging purposes.
Here is a handy list of some of these values:
http://en.wikipedia.org/wiki/Magic_number_%28programming%29#Magic_debug_values
answered May 25, 2010 at 18:10 Scott
4 upvotes
People normally use it to indicate dummy values. I think that it primarily was used before the idea of NULL pointers.
answered May 25, 2010 at 18:09 Puppy
3 upvotes
It's a magic number used in various places because it also happens to be readable in English, making it stand out.
There's a partial list on Wikipedia.
answered May 25, 2010 at 18:11 dsolimano
2 upvotes
It was used as a pattern to store in memory as a series of hex bytes (0xde, 0xad, 0xbe, 0xef).
You could see if memory was corrupted because of hardware failure, buffer overruns, etc.
answered May 25, 2010 at 18:11 Larry