Bojan Milankovic
Bojan Milankovic

Reputation: 847

Memorable 32-bit value as a constant

I am looking for a memorable 32-bit value to be used as a constant. 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.

Upvotes: 6

Views: 1248

Answers (12)

Ned Batchelder
Ned Batchelder

Reputation: 375634

Here are a bunch of hex words that you can use to make a constant.

A snippet of some of the words:

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

Upvotes: 3

jason
jason

Reputation: 241651

A comprehensive list of magic constants is here:

Hexspeak

Magic Number

And see the links therein.

Upvotes: 18

pixelbeat
pixelbeat

Reputation: 31728

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' '

Upvotes: 3

Taylor Price
Taylor Price

Reputation: 642

I'm a fan of 0xBAADF00D.

Upvotes: 1

user14554
user14554

Reputation:

0x0BE5EBEE 0xADEAD60D

Upvotes: 1

kenny
kenny

Reputation: 22344

I like 600df00d

Upvotes: 1

Nosredna
Nosredna

Reputation: 86216

0x00abacab

(Which happened WAY after Peter Gabriel left.)

Upvotes: 1

Sinan Ünür
Sinan Ünür

Reputation: 118148

0xBADDD00D, 0xBADDFACE, 0xCAFEF00D, 0xBAADCAAB, 0xBADCAB1E etc etc

Upvotes: 1

UncleBens
UncleBens

Reputation: 41341

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.

#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
    );
}

Upvotes: 14

t0mm13b
t0mm13b

Reputation: 34592

Here's another: 0xDEADCAFE :)

Upvotes: 1

Richard Pennington
Richard Pennington

Reputation: 19965

The classic is 0xdeadbeef.

Upvotes: 2

schnaader
schnaader

Reputation: 49719

0xDEADBEEF 0xDEADBABE

...

Hexspeak

Upvotes: 1

Related Questions