Y
Hacker News
new
|
ask
|
show
|
jobs
by
jibal
62 days ago
Per the C standard `sizeof(char)` is always 1, regardless of how many bits it has.
3 comments
Maxatar
61 days 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.
link
ddlsmurf
62 days ago
because it's the unit of addressable memory that C is concerned by with sizeof, otherwise its values still depend on CHAR_BIT
link
dmitrygr
62 days ago
What you seek is CHAR_BIT
link
jibal
62 days ago
You're talking to the wrong person. I was on the C Standards Committee and am well aware of CHAR_BIT.
link