The ISO C Standard requires CHAR_BIT
to be at least 8.
With POSIX mandating CHAR_BIT
be equal to 8, and (almost?) all networking and communication standards using octets, is there any contemporary C implementation where CHAR_BIT
> 8?
(Note: I'm not interested in historic computer architectures using 18 or 36 bit words. It's genuinely a question about C as it is used today on current hardware; think systems with a C99 or later implementation).
Even if you think of a “character” as a multi-byte thingy, char is not. sizeof(char) is always exactly 1. No exceptions, ever.
"char" has always been a misspelling of "byte" in C. sizeof(char) has to be 1, but char doesn't have to be 1 byte in size. It's more correct to say that sizeof(foo) returns a result relative to sizeof(char).
TMS320C28x DSP from Texas Instruments has a byte with 16 bits.
Documentation for the compiler specifies CHAR_BIT
as 16 on page 101.
This appears to be a modern processor (currently being sold), compilers supporting C99 and C++03.
Another example is Analog Devices' SHARC processor family.
Its C implementation, CrossCore Embedded Studio, has CHAR_BIT == 32
and claims to provide freestanding C99 and C++11 conformance.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With