3 ms·
wchar_t should never be used in any new code
by charliesome 14y ago
wchar_t should never be used in any new code
- ygra 14y agoJust out of curiosity: What is its replacement? If I remember correctly it began its life as the char type for multi-byte character sets and later found use for UTF-(16|32) code units. Should Unicode strings forcibly be UTF-8 in all programs and use char again (thus suffering from the same problem that Python 2 had where bytestrings and Unicode strings weren't sufficiently distinguished, often leading to programmers using the former for text)? Or should you use short/int arrays instead and have no support from the stdlib at all for handling them (not that the stdlib is particularly good at handling text)?
- charliesome 14y agoIf you're using UTF-8, use either uint8_t* (preferred) or char. If you're using UTF-32, use uint32_t. If you're using UTF-16, don't. As far as library support goes, there are a few good Unicode libraries for C, most notably ICU4C.
- deleted 14y ago[deleted]