A few weeks ago I needed a few integer values whose hexadecimal values were clearly recognizable when debugging -- magic numbers. I did a search on the web for a list of good magic number, which I was sure would exist, but couldn't find any. I ended up using 0xBADDEAD and 0xBEEFDAD which I thought were pretty good.Then I made a mistake: I decided that I should make that list of magic numbers if no one else would. It wasn't until I was done that that I realized the depth of pointlessness of the thing I had just done. But here it is: a list of all hexadecimal words that are meaningful in the english language, in the form of a google spreadsheet. As proof of the words' meaningfulness each word has a link to a dictionary or encyclopedia describing the meaning. Most of them are pretty obscure -- like dace, a small fish, or eba, a food eaten in West Africa. However, some are pretty meaningful (scroll down to see the list, for some reason blogger messes up the formatting):
| ace | A playing card |
| bad | Not good; unfavorable; negative |
| bead | A small decorative object |
| bee | A flying insect |
| beef | Culinary name for meat from bovines |
| cab | A type of public transport |
| cafe | A coffee-shop |
| dad | Father |
| dead | Bereft of life |
| deaf | Insensitive to sound |
| decade | A period of 10 years |
| decaf | Decaffeinated coffee |
| fabaceae | A family of flowering plants |
| facade | The front of a building |
| face | The front part of the head |
The next time I or anyone else has to come up with a magic number it should be a lot easier. I'll try to ignore the fact that I probably spent ten times as long compiling this list as any programmer spends inventing magic numbers in a lifetime.

3 comments:
I don't want to dispute your assertion that this is a waste of time, but:
You can use zero for the letter o and one for the letter l too. On a Linux box the following (all on one line) will get you a nice list:
egrep '^[oOla-f]{1,8}$' /usr/share/dict/words
At this point, xkcd's elaborate fantasies seem strangely appropriate.
Ned Batchelder made such a list. His also uses 5 for S and 7 for T. See here.
D'oh, I really should have included zero. I've missed words like c0ffee, d00dad and face0ff. Using 1 as L does make the words harder to read I think. It did give me an idea though: in Java you can use the L at the end of a long constant as part of the word: 0xC00L.
Seeing that someone else has done this makes me feel better about doing it myself. However, I think using 5 and 7 (and 8 for ate) makes some of the words very hard to read -- 7e55e118, f0071005e.
Maybe they could be allowed if there was a rule that they could only occur in places surrounded by real letters, or only one or two times in a word.
Post a Comment