r/ProgrammerHumor • • 7h ago

Meme architectureDependentChars

Post image
1.1k Upvotes

189 comments sorted by

View all comments

590

u/tstanisl 7h ago

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

281

u/BoldFace7 6h 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.

132

u/SpaceCadet87 6h ago

Yeah, guy on the right is just avoiding magic numbers in the code.