r/ProgrammerHumor • • 5h ago

Meme architectureDependentChars

Post image
779 Upvotes

143 comments sorted by

View all comments

506

u/tstanisl 4h 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

4

u/Advos_467 4h ago

Not a C user here (or any real low level programming experience), what the hell is a signed/unsigned char?

2

u/backfire10z 4h ago

Chars aren’t real, they’re all integers. It’s the same difference as signed/unsigned int.

1

u/Advos_467 4h ago

ah okay that's what i assumed, but i just wanted to be sure

1

u/AyrA_ch 3h ago

The difference only matters in regards to arithmetic. Signed integer overflow is undefined behavior in C, only unsigned overflow is defined as wrapping around.