Why is wchar_t needed? How is it superior to short (or __int16 or whatever)?
(If it matters: I live in Windows world. I don’t know what Linux does to support Unicode.)
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
In the C++ world,
wchar_tis its own type (I think it’s atypedefin C), so you can overload functions based on this. For example, this makes it possible to output wide characters and not to output their numerical value. In VC6, wherewchar_twas just atypedefforunsigned short, this codewould output
65becausewas invoked. In newer VC versions
wchar_tis a distinct type, sois called, and that outputs
A.