MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1w2m4qz/bugintroduceddebugging/p6vlxz3/?context=3
r/ProgrammerHumor • u/ClipboardCopyPaste • 2d ago
120 comments sorted by
View all comments
Show parent comments
17
char would be the correct answer, as the C standard doesn't mandate a byte be 8 bits (6 and 32 are very uncommon nowadays but not unheard of, and there's a few machines out there that get really creative).
6 u/mckenzie_keith 2d ago So even on weird platforms where char is a 32 bit type, sizeof (char) is 1, right? I can't remember. 2 u/AnnoyedVelociraptor 2d ago FYI char in Rust is 32-bits, maximum size of a UTF-8 character 2 u/cowslayer7890 2d ago And in Java it's 16-bit, which means some Unicode characters get split in two
6
So even on weird platforms where char is a 32 bit type, sizeof (char) is 1, right? I can't remember.
2 u/AnnoyedVelociraptor 2d ago FYI char in Rust is 32-bits, maximum size of a UTF-8 character 2 u/cowslayer7890 2d ago And in Java it's 16-bit, which means some Unicode characters get split in two
2
FYI char in Rust is 32-bits, maximum size of a UTF-8 character
2 u/cowslayer7890 2d ago And in Java it's 16-bit, which means some Unicode characters get split in two
And in Java it's 16-bit, which means some Unicode characters get split in two
17
u/yjlom 2d ago
char would be the correct answer, as the C standard doesn't mandate a byte be 8 bits (6 and 32 are very uncommon nowadays but not unheard of, and there's a few machines out there that get really creative).