The compiler decides this. However, in the case of C and C++, the compiler typically follows the CPU for reasons of performance.
On a platform where the smallest addressable unit is 16 bits wide, a compiler could implement 8-bit char
but it would have to (1) emit instructions to get the 8 bit units out of 16-bit "bytes" and (2) every char*
or void*
would need an additional bit to indicate lower/upper half.
Vice versa, you could implement a compiler with 16-bit char
on an x86, but that would mean all C strings would take twice as much memory as they usually do and it would be hard to interface to the outside world, which speaks 8-bit char
.