char is a fundamental type. wchar_t evolved as the first library solution (in C), and then became an inline type with a base type corresponding to the type previously used for typedef it:
C ++ 11 $ 3.9.1 / 5" The wchar_t type shall have the same size, signature and alignment requirements (3.11) as one of the other integral types, called its base type.
This explains why you cannot change the wchar_t signature, but does not explain why there is a char type with an undefined signature.
In addition, choosing a signed char , which is used by most compilers by default, is impractical for several reasons. One reason is that negative values โโare annoying and should usually be distinguished without sign in order to compare them. Another reason is that the character classification functions of C require non-negative values โโ(unless they are transmitted by EOF ). The third reason is that at old stations with a magnitude and sign or on one addition there is one unsuitable value.
There may be some explanation in โStroustrupโ โDesign and evolution of C ++โ, but I doubt it.
It sounds like a frozen story, something that at some point made some sense for the technology at that time.
Cheers and hth. - alf
source share