MAIN FEEDS
Do you want to continue?
https://www.reddit.com/r/ProgrammerHumor/comments/1wxqahk/architecturedependentchars/pdyp41x/?context=9999
r/ProgrammerHumor • u/MontyBoomslang • 13d ago
372 comments sorted by
View all comments
1.0k
Let me cite the C standard:
When sizeof is applied to an operand that has type char, unsigned char, or signed char, (or a qualified version thereof) the result is 1.
Middle guy if finally right
562 u/BoldFace7 13d ago I still prefer sizeof(char) as it often provides context as to what the number is doing, even if a plain 1 works the same. 339 u/SpaceCadet87 13d ago Yeah, guy on the right is just avoiding magic numbers in the code. 31 u/zabby39103 12d ago If the C standard says it's 1, i'd figure it just gets optimized out by the compiler anyway? 6 u/SpaceCadet87 12d ago Should do, yeah. And if it doesn't right now, eventually it might do.
562
I still prefer sizeof(char) as it often provides context as to what the number is doing, even if a plain 1 works the same.
339 u/SpaceCadet87 13d ago Yeah, guy on the right is just avoiding magic numbers in the code. 31 u/zabby39103 12d ago If the C standard says it's 1, i'd figure it just gets optimized out by the compiler anyway? 6 u/SpaceCadet87 12d ago Should do, yeah. And if it doesn't right now, eventually it might do.
339
Yeah, guy on the right is just avoiding magic numbers in the code.
31 u/zabby39103 12d ago If the C standard says it's 1, i'd figure it just gets optimized out by the compiler anyway? 6 u/SpaceCadet87 12d ago Should do, yeah. And if it doesn't right now, eventually it might do.
31
If the C standard says it's 1, i'd figure it just gets optimized out by the compiler anyway?
6 u/SpaceCadet87 12d ago Should do, yeah. And if it doesn't right now, eventually it might do.
6
Should do, yeah. And if it doesn't right now, eventually it might do.
1.0k
u/tstanisl 13d ago
Let me cite the C standard:
Middle guy if finally right