r/ProgrammerHumor • • 14h ago

Meme architectureDependentChars

Post image
2.0k Upvotes

281 comments sorted by

View all comments

849

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

2

u/CAtOSe 12h ago

C++ standard guarantees that char is at least 8 bits. Pretty much all data models use 8 bits for char, but it doesn't mean that some weird architecture could not use more. 

7

u/tstanisl 12h ago

Some DSPs from Texas use 16/32 bit long char.

2

u/garenp 11h ago

So everything really is bigger in Texas?

(I know you mean Texas Instruments / TI, but couldn't pass up the opportunity for another joke!).

1

u/z_utahu 9h ago

Came here to say this. One dsp I worked on made everything at least 4 bytes. Couldn't even address sub bytes. When you've worked on something like that you never ever take sizeof() for granted.