Re:C's Flexible Integer Sizes Were Not a Design Mistake
by jibal on Sunday September 27, 2026 @06:34AM
(#49865409)
Per the C standard `sizeof(char)` is always 1, regardless of how many bits it has.
[ Parent
| on HN ]
Re:C's Flexible Integer Sizes Were Not a Design Mistake
by ddlsmurf on Sunday September 27, 2026 @06:51AM
(#49865510)
because it's the unit of addressable memory that C is concerned by with sizeof, otherwise its values still depend on CHAR_BIT
Re:C's Flexible Integer Sizes Were Not a Design Mistake
by dmitrygr on Sunday September 27, 2026 @08:49PM
(#49872315)
What you seek is CHAR_BIT
Re:C's Flexible Integer Sizes Were Not a Design Mistake
by jibal on Monday September 28, 2026 @01:30AM
(#49874007)
You're talking to the wrong person. I was on the C Standards Committee and am well aware of CHAR_BIT.
Re:C's Flexible Integer Sizes Were Not a Design Mistake
by Maxatar on Monday September 28, 2026 @10:40AM
(#49878748)
You are mixing some things up. Yes the `sizeof(char)` is defined to always be 1 by the standard... but the size of char is not 1, it's defined by CHAR_BIT which can in principle vary from platform to platform.