簡體   English   中英

令人難忘的32位值作為常量

[英]Memorable 32-bit value as a constant

我正在尋找一個令人難忘的32位值作為常量。 如果可能的話,它也應該有點滑稽。

到目前為止,我已經提出了這兩個:

0xcafebabe

0xdeaddad

你也可以推薦一些其他的嗎?

謝謝。

這里有一個完整的魔術常量列表:

Hexspeak

幻數

並查看其中的鏈接。

我想知道,作為程序員,你需要問。 畢竟它需要一個單詞列表和一行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
    );
}

以下是一組可用於制作常量的十六進制單詞

一些單詞的片段:

ba5eba11
bedabb1e
be5077ed
b0a710ad
b01dface
cab005e
ca11ab1e
ca55e77e
deadbea7
defec8
f01dab1e
f005ba11
0ddba11
5ca1ab1e
7e1eca57

你可以很容易地找到它們。

sed '/[^a-folt]/d' /usr/share/dict/words | tr olt 017 |
awk '{print length, $0}' | sort -n | cut -f2- -d' '

經典是0xdeadbeef。

0xDEADBEEF 0xDEADBABE

...

Hexspeak

這是另一個:0xDEADCAFE :)

0xBADDD00D0xBADDFACE0xCAFEF00D0xBAADCAAB0xBADCAB1E等等

0x00abacab

(在彼得加布里埃爾離開之后發生了這種情況。)

我喜歡600df00d

0x0BE5EBEE 0xADEAD60D

我是0xBAADF00D的粉絲。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM