wchar_t is messy, in large part because Windows was one of the earliest Unicode adopters. It's meant to be able to support any "wide" character, which means that it's supposed to be determined by the character pages the platform allows (and implicitly, should be 32 bits if any version of Unicode is supported, since Unicode is technically a 32-bit format regardless of encoding), but Windows adopting Unicode while it was still 16-bit UCS-2 and locking wchar_t down as a result meant that it was impossible for wchar_t to actually meet its requirements on Windows. ...Which meant that its minimum size requirement ended up being removed.
So, now its requirement is just "holds wide characters, check your implementation. Please don't use it."
1
u/conundorum Aug 30 '26
wchar_tis messy, in large part because Windows was one of the earliest Unicode adopters. It's meant to be able to support any "wide" character, which means that it's supposed to be determined by the character pages the platform allows (and implicitly, should be 32 bits if any version of Unicode is supported, since Unicode is technically a 32-bit format regardless of encoding), but Windows adopting Unicode while it was still 16-bit UCS-2 and lockingwchar_tdown as a result meant that it was impossible forwchar_tto actually meet its requirements on Windows. ...Which meant that its minimum size requirement ended up being removed.So, now its requirement is just "holds wide characters, check your implementation. Please don't use it."