Why was wchar_t invented?

前端 未结 10 1692
说谎
说谎 2021-01-03 20:15

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

10条回答
  •  南方客
    南方客 (楼主)
    2021-01-03 20:52

    It is usually considered a good thing to give things such as data types meaningful names.

    What is best, char or int8? I think this:

    char name[] = "Bob";
    

    is much easier to understand than this:

    int8 name[] = "Bob";
    

    It's the same thing with wchar_t and int16.

提交回复
热议问题