One of the technical terms for such values is the “venom value”.
The hexadecimal numbers that form English words are called Hexspeak. The Hexspeak Wikipedia article largely answers this question by cataloging many well-known constants used for different things, including several that are used as indicators of poison / canary / sanity checks, as well as other uses, such as error codes or addresses IPv6.
I seem to recall some change to 0xBADF00D . (possibly with a duplicate letter, as your second example).
There is also 0xDEADC0DE . (Googling for where I saw this found the Wikipedia article linked above).
Other English words in hexadecimal I saw: Java .class files use 0xCAFEBABE as a magic number (first 4 bytes of the file). As a game on this, I think the Jikes JVM uses 0xDEADBABE as a health check constant.
Apparently, Java was not the first user of 0xCAFEBABE . Wikipedia says: “ It was originally created by NeXTSTEP developers as a reference to barists on Peet Coffee and Tea ” and was used by people who developed Java before they thought of the name “Java”. Thus, he did not come out of Java → coffee (if something is the other way around), it is just an old non-feminist technical culture .: (
re: update: Choosing a good value . For the poison value (not the error code), you want all the bytes to be different, not 0x00 or 0xFF , as these are probably the most likely values for the erroneous single-byte storage. This is especially important for things like the canary stack (for detecting buffer overflows), or in other cases where it is important to note that it is not overwritten.
Your assumptions about choosing an odd value make a lot of sense. The wrong memory address in the virtual memory layout of typical processes is a big advantage . Failure as early as possible is optimal for debugging. Anyway, this probably means having a set of high bits is a good idea, so 0x0... is probably not a good idea.
source share