[英]Memorable 32-bit value as a constant
I am looking for a memorable 32-bit value to be used as a constant. 我正在寻找一个令人难忘的32位值作为常量。 If possible, it should be somewhat funny too.
如果可能的话,它也应该有点滑稽。
So far, I have come up with these two: 到目前为止,我已经提出了这两个:
0xcafebabe
0xdeaddad
Can you please suggest some other too? 你也可以推荐一些其他的吗?
Thank you. 谢谢。
A comprehensive list of magic constants is here: 这里有一个完整的魔术常量列表:
And see the links therein. 并查看其中的链接。
I wonder, that as a programmer you need to ask. 我想知道,作为程序员,你需要问。 After all it takes a word-list and a one-liner of C++ to find suitable words.
毕竟它需要一个单词列表和一行C ++才能找到合适的单词。
#include <iterator>
#include <string>
#include <algorithm>
#include <iostream>
#include <boost/lambda/lambda.hpp>
#include <boost/lambda/bind.hpp>
int main()
{
using namespace boost::lambda;
std::remove_copy_if(
std::istream_iterator<std::string>(std::cin),
std::istream_iterator<std::string>(),
std::ostream_iterator<std::string>(std::cout, " "),
bind(&std::string::size, _1) != 8u
||
bind(
static_cast<std::string::size_type (std::string::*)(const char*, std::string::size_type) const>(
&std::string::find_first_not_of
),
_1,
"abcdefgiost",
0u
) != std::string::npos
);
}
You can find them yourself easily enough. 你可以很容易地找到它们。
sed '/[^a-folt]/d' /usr/share/dict/words | tr olt 017 |
awk '{print length, $0}' | sort -n | cut -f2- -d' '
经典是0xdeadbeef。
这是另一个:0xDEADCAFE :)
0xBADDD00D
, 0xBADDFACE
, 0xCAFEF00D
, 0xBAADCAAB
, 0xBADCAB1E
等等
0x00abacab 0x00abacab
(Which happened WAY after Peter Gabriel left.) (在彼得加布里埃尔离开之后发生了这种情况。)
我喜欢600df00d
0x0BE5EBEE 0xADEAD60D
我是0xBAADF00D的粉丝。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.