Live data from Hacker News

0xCAFEBABE & 0xFEEDFACE (2003)

radio-weblogs.com

61–70 of 126 posts

Re: 0xCAFEBABE & 0xFEEDFACE (2003)

#62

Rust will yell at you if you use specific magic numbers like these edit: yes, 0xCAFEBABE is a warning but 0xFEEDFACE is not: 3405691582 https://github.com/rust-lang/rust/blob/d0ea1d767925d53b2230e...

Kind of low-key hilarious that someone thought this was a serious enough issue to actually submit that code. I wonder if there is a written spec that helps to judge which integers should be considered "problematic" and which ones aren't.

The actual diff in question [1] does show that there have been multiple cases where such "magic" numbers did appear in rustc, so that the lint is meant to catch any such known cases to reduce possibly resulting complaints in advance, no matter you like them or not. (This is also why the list is not as exhaustive, as it needn't to be.)

[1] https://github.com/rust-lang/rust/pull/92469/files

Re: 0xCAFEBABE & 0xFEEDFACE (2003)

#63
post #24

Earlier quoted context omitted.

But why?

https://www.oxfordlearnersdictionaries.com/definition/englis... > but sometimes considered offensive if used by a man to a woman he does not know There are billions of other magic numbers to choose from anyway.

So someone using "0xCAFEBABE" or whatever, do you really think women take it personally, or what is the problem here? If I were to use it, there would be no target, and I doubt in most common uses there are any, so it does not make much sense to me.

Re: 0xCAFEBABE & 0xFEEDFACE (2003)

#64

Earlier quoted context omitted.

That says all I need to know about the community.

Really? Current mainstream political shibboleths are more important than for example their stance on module versioning or on whether C code should have a right to exist?

Yes.

Re: 0xCAFEBABE & 0xFEEDFACE (2003)

#65
post #39

Earlier quoted context omitted.

Reformatted: irb> [184594741, 2880289470, 2881141438, 2965027518, 2976579765, 3203381950, 3405691582, 3405697037, 3735927486, 4027431614, 4276992702].map! { _1.to_s(16) } => ["b00b135", "abadbabe", "abbababe", "b0bababe", "b16b00b5", "beefbabe", "cafebabe", "cafed00d", "deadbabe", "f00dbabe", "feedbabe"]

I wonder why are many many "babe" constants included, but only a single "d00d" constant.

It's probably based on the Hexspeak Wikipedia page [1], which contains 7 "babe" constants and only 2 "d00d" constants. So we already had much more "babe" magic constants to start with, I wonder why... ;-)

[1] https://en.wikipedia.org/wiki/Hexspeak

Re: 0xCAFEBABE & 0xFEEDFACE (2003)

#66
My preferred way to make a "magic" constant has been using base64. For example, 0x31a82270 maps to base64 `MagicA==`. This approach is most useful when the magic constant itself shouldn't be obviously ASCII but still should be meaningful enough.

Re: 0xCAFEBABE & 0xFEEDFACE (2003)

#67
post #29

Earlier quoted context omitted.

Not just that, but they also wrote the numbers in decimal - they didn't even want them in the code as an example of what not to do. Maybe someone was having too much fun and got carried away, but what an odd sense of humor.

> wrote the numbers in decimal Maybe they just didn't want the checker to flag itself. I remember there was a similar check inside Google, where any file containing the words "DO NOT SUBMIT" will cause the presubmit check to fail. Naturally the presubmit checker needs to look for that string, but it couldn't trivially include the string as-is because that would prevent the presubmit checker from being submitted. (Mot…

It's also fun if you want to include that string in a template file so that users of the template don't forget to fill in the template before submitting.

Re: 0xCAFEBABE & 0xFEEDFACE (2003)

#68

Rust will yell at you if you use specific magic numbers like these edit: yes, 0xCAFEBABE is a warning but 0xFEEDFACE is not: 3405691582 https://github.com/rust-lang/rust/blob/d0ea1d767925d53b2230e...

Kind of low-key hilarious that someone thought this was a serious enough issue to actually submit that code. I wonder if there is a written spec that helps to judge which integers should be considered "problematic" and which ones aren't.

And now I can't unrememeber and feel totally compelled to a) translate them and b) use them in my code somewhere. Cannot help but think this is a deliberate pun, to get cynic's imagination going ... did they do this to poke fun at the PC brigade asking for it, or were they actually seriously believing it would make users look the other way ? Either option is funny.

(practically, used only "F0015601D" ... as IPv6 link-local address. No, wasn't a honeypot service)

Re: 0xCAFEBABE & 0xFEEDFACE (2003)

#70

a long time a go I wrote a script that spit out random phrases in hex that would work as a mac address. I used to do this to mess with my coworkers in networking , and previous coworkers at the ISP I was still using. My HN username is the only one i remember though.

7415 8E55A6E 15 A99407ED!
Post reply on HN