博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
deadbeef---Hexspeak http://en.wikipedia.org/wiki/Hexspeak
阅读量:2400 次
发布时间:2019-05-10

本文共 2792 字,大约阅读时间需要 9 分钟。

Hexspeak, like , is a novelty form of variant spelling.

Hexspeak was created by programmers who wanted a , a clear and unique identifier with which to mark memory or data. Using , which includes the digits 0123456789ABCDEF, it is possible to create small words with the digit "0" representing the letter "O", "1" representing the letter "I", and "5" representing "S".

Contents

[]
<script type="text/javascript"> // </script>

[] Notable magic numbers

Many , , and make use of magic numbers, especially as a .

  • 0xABADBABE ("a bad babe") is used by Apple as the "Boot Zero Block" magic number.
  • 0xBAADF00D ("bad food") is used by Microsoft's LocalAlloc(LMEM_FIXED) to indicate uninitialised allocated heap memory.
  • 0xBADDCAFE ("bad cafe") is used by 'watchmalloc' in to mark allocated but uninitialized memory.
  • 0xCAFEBABE ("cafe babe") is used by both ("" in both 68k and PowerPC) to identify object files and the to identify class files
  • 0xDEADBEEF ("dead beef") is used by IBM systems, on 32-bit processors and the as a magic debug value. On ' , marks freed kernel memory
  • 0xDEFEC8ED ("defecated") is the magic number for .
  • 0xFEEDFACE ("feed face") is used as a header for Mach-O binaries, and as an invalid pointer value for 'watchmalloc' in .

[] Designing magic numbers

Given there are at least a few hundred words in English consisting of only the letters "a", "b", "c", "d", "e", "f", "o", "i" and "s", it is easy for programmers to devise their own, such as 0xD15EA5ED or 0xBED51DE5. As such, it is useful to observe a few patterns in the classic hexspeak constants given above. These constants all use the full width of the word (in this case 32-bit), and none begin with "1" or "5". This choice means that if the word is interpreted as an integer, it is a (usually large) negative integer. For example, 0xBAADF00D is -1163005939, a large negative integer that is unlikely to arise in many programs. Microsoft's 0xBAADF00D is also a good value to catch access to uninitialised memory for another reason—ending the word with the "1", "5", "b", "d", or "f" ensures that the constant is an odd number, which generates an on many processor architectures if the constant is interpreted as a pointer value.[]

[] Alternative letters

  • The notation uses the "0x" prefix to indicate a hexadecimal number; the "0x" is usually ignored when reading the letters.
  • In the , hexadecimal numbers are denoted by a "h" suffix. For example: FEEDADEADF15h ("feed a dead fish"). Note that numbers in this notation that begin with a letter have to start with a zero to distinguish them from variable names. "FEEDADEADF15h" would then be "0FEEDADEADF15h".
  • In the , hexadecimal numbers are denoted by a "$" prefix. This allows words starting with the letter "S", for example $EED ("seed").

[] See also

[] External links

转载地址:http://dgnob.baihongyu.com/

你可能感兴趣的文章
python列表元组的操作
查看>>
python基础之元组、文件操作、编码、函数、变量
查看>>
两个路径下的iptables的区别
查看>>
wsgi.py的详解
查看>>
python中setting.py详解
查看>>
python的__init__.py
查看>>
最新pycharm破解(亲试有效)
查看>>
Python实现的快速排序
查看>>
Python基础之os和数据结构
查看>>
自动化运维平台的实施计划
查看>>
《大鱼海棠》里的梦
查看>>
自动化平台的几个小计划
查看>>
推荐给你的春节观影清单,请查收
查看>>
DBAplus社群北京站沙龙归来
查看>>
最近在读的一些文章和书
查看>>
MySQL关于数据字典的一个疑问
查看>>
今天的一点杂感
查看>>
从阴阳五行,四书五经到国学的理解
查看>>
如何理解Python web开发技术
查看>>
自动化平台中维度设计的一点思考
查看>>