this post was submitted on 15 Nov 2023
233 points (97.6% liked)
Programmer Humor
19551 readers
772 users here now
Welcome to Programmer Humor!
This is a place where you can post jokes, memes, humor, etc. related to programming!
For sharing awful code theres also Programming Horror.
Rules
- Keep content in english
- No advertisements
- Posts must be related to programming or programmer topics
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
That's kind of wild, I double-checked and it's true.
Although I disagree with the second part, the Rust folks wouldn't care about the in-memory representation as long as the compilation is on point.
Looking closer at the final enum, I guess it's because there are nine possible cases for it, making the compiler pack it into 4 bits, with one number representing each? I checked and
None
is represented as8
, while 7Some
s containing aNone
is 0 and the full 8Some
s is represented by1
.Well I can't speak for everyone, but Rust is very intentional about supporting things like
repr(C)
. At least some of us care a lot.