Comment by layer8
5 hours ago
> Language types such as char, int, short, and long do not come with a guarantee of how many bytes they occupy in memory.
Char is actually guaranteed by C to occupy exactly 1 byte in memory. It’s just that a byte can have more than eight bits in C. “Byte” is simply the smallest unit of memory addressable by a pointer.
Further down the article acknowledges that “C requires char to have at least 8 bits (CHAR_BIT >= 8), not exactly 8” and mentions the Honeywell 6000 as an example of a C implementation with 9 bits (and 36-bit ints).
Historically in computing, the size of a byte was hardware-dependent and not standardized. The Wikipedia article on “byte” cites Knuth’s 1968 TAOCP where byte denotes a unit which “contains an unspecified amount of information […] capable of holding at least 64 distinct values […] at most 100 distinct values. On a binary computer a byte must therefore be composed of six bits”.
> C requires char to have at least 8 bits (CHAR_BIT >= 8)
The famous TI C55x DSP with 16 bits byte for example: https://news.ycombinator.com/item?id=3112704.
And they are still available new for purchase.