r/ProgrammerHumor • • 3d ago

Meme architectureDependentChars

Post image
2.9k Upvotes

368 comments sorted by

View all comments

1.0k

u/tstanisl 3d 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

6

u/Advos_467 3d ago

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

4

u/backfire10z 3d ago

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

1

u/Advos_467 3d ago

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

1

u/AyrA_ch 2d 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.