Better HN
top
new
best
ask
show
jobs
Log in
Sign up
Better HN
Comment
by
jibal
· 1mo ago · 0 comments
Per the C standard `sizeof(char)` is always 1, regardless of how many bits it has.
Comments
[–]
Maxatar
1mo ago
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.
[–]
ddlsmurf
1mo ago
because it's the unit of addressable memory that C is concerned by with sizeof, otherwise its values still depend on CHAR_BIT
[–]
dmitrygr
1mo ago
What you seek is CHAR_BIT
[–]
jibal
OP
1mo ago
You're talking to the wrong person. I was on the C Standards Committee and am well aware of CHAR_BIT.