7 ms·
0xCAFEBABE & 0xFEEDFACE (2003)
- novagameco 2y agoRust 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/d0ea1d767925d53b2230e2ba81197821514781f0/src/tools/tidy/src/style.rs#L59 https://github.com/rust-lang/rust/blob/d0ea1d767925d53b2230e...
- kevindamm 2y agothat sounds like 0xBADDBEEF
- esterly 2y agoOxDEADBEEF
- oguz-ismail 2y ago0xB16B00B5
- steveklabnik 2y agoThis is only for rustc, not for arbitrary rust programs.
- userbinator 2y agoThat says all I need to know about the community.
- tbrownaw 2y agoReally? 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?
- oguz-ismail 2y agoYes.
- kragen 2y agoit seems likely that the degree of importance they accord to current mainstream political shibboleths is informative about the community's value system and decision-making process, and therefore how it will change its policy on module versioning and c code in the next few years probably some people will think it's encouraging information, and others will think it's discouraging information, but either way it's important information
- GolberThorce 2y ago>right to exist we must secure the existence of C code and a future for node children
- SanjayMehta 2y agoBut why?
- nimih 2y agoIt's a mystery, lost to the sands of time. IMO, it's highly unlikely anyone will ever discover why the maintainers of the Rust compiler decided to lint their codebase for a dozen or so magic numbers.
- SanjayMehta 2y agoI feel my leg is being pulled, ever so gently.
- fch42 2y agothe github commit's "conversations" log for the commit has a few notes you need to log in for to view. But then, the maintainer who merged said "it's just a few constants". Which is fair enough. I think this would more belong into clippy; it'd be easier extensible then, and less "magic". But I'm just a 0xf001 who's intentions are 0x900d ... please don't let me 0xbe misunderst0x0d.
- cbzbc 2y agoIt's fairly simple - and I don't know why no one has pointed this out already. If everyone starts to use the same magic numbers then they are no longer magic and you can end up with strange corner case bugs and holes where a magic number used in one context is mistaken for a magic number in another context.
- Krssst 2y agohttps://www.oxfordlearnersdictionaries.com/definition/english/babe 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.
- johnisgood 2y ago
- ryandrake 2y agoKind 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.
- yongjik 2y agoNot 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.
- omoikane 2y ago> 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. (Motivation for something like this is that if you inserted some extra logging statements or similar for debugging, you would add "DO NOT SUBMIT" in nearby comments, so that you will remember to remove them later).
- 8n4vidtmkvmk 2y agoIt'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.
- 3836293648 2y agoBut it's clippy, you can just annotate it with an #[allow(problematic_constants)]
- Duwensatzaj 2y agoIt’s not humor. It’s religion for the irreligious.
- pton_xd 2y agoNo wonder the compile times are so slow. Rustc comes with built-in content moderation! Anyway I think they forgot a few, like 173406926 (// Intentionally written in decimal rather than hex). Seems like they just checked https://en.wikipedia.org/wiki/Hexspeak https://en.wikipedia.org/wiki/Hexspeak. Kind of a weak effort, overall.
- lkj34l34 2y ago[dead]
- Lammy 2y agoReformatted: 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"]
- deleted 2y ago[deleted]
- hyperhopper 2y agoI wonder why are many many "babe" constants included, but only a single "d00d" constant.
- ramon156 2y agoIt's because soos is the most perfect man
- lifthrasiir 2y agoIt'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 https://en.wikipedia.org/wiki/Hexspeak
- KineticLensman 2y agoBurn baby burn (As per the Apollo guidance computer)
- kragen 2y agoif your coworker says 'ana over in sales is a babe' they're almost certainly commenting on her appearance, not just mentioning her gender. even if they don't explicitly mention her b16 b00b5, you may reasonably wonder if they're judging you on the same basis, and in particular whether you'd have a better yearly peer evaluation if you were a dowdy man instead of a dowdy woman if they instead say 'leslie over in sales is a dood' they're just being explicit about his gender, perhaps because someone thought he was female i'm not endorsing any value judgments for or against these statements, just explaining what other people's thinking (factually) is which leads to the kind of value judgments that lead to policies against putting b00b135 in your source code i suspect cafed00d was included as a (possibly counterproductive) gesture to allay equity concerns like yours rather than because of any serious concern that a cafed00d constant would cause anyone any concern on its own
- hoseja 2y agoRustaceans NOT beating the allegations.
- ThrowawayTestr 2y agoWhat a meme language.
- rr808 2y ago0xDDDB00B5
- bitwize 2y agoThat's a Code of Conduct violation. It's not the 90s anymore, there's no quarter for this type of thing in modern development teams. Rust's style checker even flags up the use problematic magic numbers.
- steveklabnik 2y agoThis is only for rustc, not for arbitrary rust programs.
- cpburns2009 2y agoWouldn't rustc flagging "problematic" numbers prevent arbitrary rust programs from having them in the source?
- bitwize 2y agoHe means that the style checker only checks for those sorts of numbers in the source code to rustc. But the point remains: there is far, far less tolerance for the sort of humor that objectifies women today, and even laughing at it can get you in trouble as Tim Peters recently found out.
- nequo 2y agoI mean, 0xDDDB00B5 is about as appropriate in a codebase as 0xB166D1C5 or 0x73571C23 would be. Which is to say, it isn’t.
- l33t7332273 2y agoWhat objectionable thing is 0x73571C23 supposed to be?
- cdchn 2y agoI'm surprised they didn't use 0xDECAFBAD for the Java format. Even more interesting is the Wikipedia page https://en.wikipedia.org/wiki/Hexspeak https://en.wikipedia.org/wiki/Hexspeak catalogs a delightfully long list of hexspeak words and what they're used for.
- joshu 2y agobecause it would need to be an even number of digits
- onionisafruit 2y agoI count 8 digits
- cdchn 2y agoSneaky isn't it? Its give for the first "word" then three for the second.
- kragen 2y agoin ur-scheme i assigned a magic number to each boxed type as an easy dynamic type test. procedures are 0xca11ab1e, variables moved onto the heap because they were captured by a closure are 0x1ce11ed, strings of text are 0xbabb1e, cons cells consisting of a car and a cdr are 0x2ce11ed, symbol objects used for naming procedures and variables are 0x1abe1, and all other types are unboxed. aside from being enjoyably silly, this was surprisingly helpful when i was single stepping through the code it generated in gdb. hex dumps are a lot easier to read when you do that http://www.canonical.org/~kragen/sw/urscheme/compiler.scm.html http://www.canonical.org/~kragen/sw/urscheme/compiler.scm.ht...
- mikewarot 2y ago0x08675309 also shows up fairly often.
- askvictor 2y agoDoes that mean anything?
- an_d_rew 2y agoIf you're a child of the 80's in North America it does! (Do a google search on the number, without the 0x0 prefix...)
- mysterydip 2y agoPop song in the 80s, 867-5309 (Jenny)
- sethrin 2y agoIt's a reference to a song ("867-5309 / Jenny") by Tommy Tutone. It's pretty dated by now.
- an_d_rew 2y agoDated?! DATED?! BLASPHEMY! ;-)
- phito 2y agoDated, just like putting noses to smileys!
- quesera 2y agoiOS speech-to-text spells "smiley face" with a nose. FWIW! :)
- phone8675309 2y agoI feel older every day.
- Jupe 2y ago= CAECBA8E
- xcdzvyn 2y ago[dead]
- 0xbadcafebee 2y agoWelp, time to trademark the old handle.
- 0xDEADFED5 2y agohey cousin!
- 0xF00DBABE 2y agoDitto. I wonder if I can get some sponsors too
- 0xDECEA5ED 2y agoHey fellas!
- malkia 2y ago0xC05FEFE
- mikehollinger 2y agoSemi-related story with some insider baseball: There are quite a few memorable words you can spell using 32 or 64 bits—like BA5EBA11. This is the story of me -not- choosing one of those. These bit-pattern words are handy because they’re easy to recognize, especially in a random memory dump. On my first “real” assignment, I was writing real-time embedded C code for a 16-bit processor that communicated with a host microprocessor on a server. We needed to run periodic assurance tests across a bus to ensure reliable communication with the host since we weren't constantly using the bus.* We were given an unused register address on the host processor and told to write whatever we wanted to it. The idea was to periodically write a value, read it back, and if we encountered any write errors, incorrect reads, or failures, we’d declare a comm error and degrade the system in a controlled manner. Instead of using zeros or something like 0xDEADBEEF, I decided to write 0x4D494B45 - "MIKE" in ASCII. It was unique, unlikely to be tampered with, it worked, and no one argued with me. The code shipped, the product shipped, and all was well. We even detected legitimate hardware errors, which I thought was pretty cool. Fast forward two generations of systems, and long after I’d moved on from that team, the code had been ported around but that assurance test remained unchanged. Everything was fine until they brought up a new generation of systems, flipped on the firmware for that device, and 10 seconds later, my assurance test clobbered an important register. The entire system promptly checkstopped and crashed. It took the team days to figure out what was wrong, and I had to explain myself when they found "MIKE" staring back at them from the memory dump. That was a fun project. ;-) * Note: It would've been bad if our device went out to lunch because we were responsible for energy management of the server. If the power budget was exceeded and we couldn't downclock and downvolt the processor, something might have crashed or been damaged.
- onionisafruit 2y agoThat was a great “Mike says no” moment.
- sargstuff 2y agovs. 80's commercial tag line about 'Mikey likes it"
- 2y ago
- Dwedit 2y agoA side benefit of the 2GB address space limit for 32-bit Windows programs is that magic numbers are not valid pointers, and will instantly cause an access violation if used.
- _tbyi 2y agoI chose my name partially for the 0xFEEEFEEE pattern that the Win32 HeapFree fills memory with in debug mode. I found it when I was very young in the debugger due to this very the reason and I've always loved the words in hex codes since!
- dec0dedab0de 2y agoa 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.
- bankcust08385 2y ago7415 8E55A6E 15 A99407ED!
- parlortricks 2y agoI always set my MAC to deadbeefcafe because it stuck out so much to see it in wireshark.
- leejoramo 2y agoGreat to see these UserLand Radio Blogs are still hosted all these years later. Dave Winer (and I am sure others) obviously worked to see that happen.
- deleted 2y ago[deleted]
- deleted 2y ago[deleted]
- lifthrasiir 2y agoMy 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.
- kragen 2y agotoo bad pointer alignment isn't visible in a base64 dump of memory
- amsterdorn 2y agoWhat about 0xDEADBEEF?
- unstatusthequo 2y agoCame here to say this
- richardmuhn 2y ago[flagged]