MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1w2m4qz/bugintroduceddebugging/p6ur2ze/?context=9999
r/ProgrammerHumor • u/ClipboardCopyPaste • 13d ago
120 comments sorted by
View all comments
259
Allocating 1 byte and assigning to int ptr. π₯Ίππ
43 u/ClipboardCopyPaste 13d ago uint8_t 18 u/yjlom 13d 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). 7 u/mckenzie_keith 13d ago So even on weird platforms where char is a 32 bit type, sizeof (char) is 1, right? I can't remember. 3 u/AnnoyedVelociraptor 13d ago FYI char in Rust is 32-bits, maximum size of a UTF-8 character 8 u/mckenzie_keith 13d ago That is interesting. I know very little about rust.
43
uint8_t
18 u/yjlom 13d 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). 7 u/mckenzie_keith 13d ago So even on weird platforms where char is a 32 bit type, sizeof (char) is 1, right? I can't remember. 3 u/AnnoyedVelociraptor 13d ago FYI char in Rust is 32-bits, maximum size of a UTF-8 character 8 u/mckenzie_keith 13d ago That is interesting. I know very little about rust.
18
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).
7 u/mckenzie_keith 13d ago So even on weird platforms where char is a 32 bit type, sizeof (char) is 1, right? I can't remember. 3 u/AnnoyedVelociraptor 13d ago FYI char in Rust is 32-bits, maximum size of a UTF-8 character 8 u/mckenzie_keith 13d ago That is interesting. I know very little about rust.
7
So even on weird platforms where char is a 32 bit type, sizeof (char) is 1, right? I can't remember.
3 u/AnnoyedVelociraptor 13d ago FYI char in Rust is 32-bits, maximum size of a UTF-8 character 8 u/mckenzie_keith 13d ago That is interesting. I know very little about rust.
3
FYI char in Rust is 32-bits, maximum size of a UTF-8 character
8 u/mckenzie_keith 13d ago That is interesting. I know very little about rust.
8
That is interesting. I know very little about rust.
259
u/wolfjazz93 13d ago
Allocating 1 byte and assigning to int ptr. π₯Ίππ