What is the difference between 'WCHAR' and 'wchar_t'?

后端 未结 5 833
执笔经年
执笔经年 2021-02-05 06:22

Is there any practical difference between WCHAR and wchar_t?

5条回答
  •  青春惊慌失措
    2021-02-05 07:14

    Does anybody know how old WCHAR is? I would imagine it dates to at least Windows NT 3.1. I'd speculate that when Microsoft started using WCHAR in the Windows headers, wchar_t was not defined in either the C or C++ standard. Please correct me if I'm wrong.

    Microsoft is in the unenviable position of having to support declarations and headers that a) must work in either C and C++ ; b) compile under very different architectures (i86, MIPS, PowerPC, Alpha, ...) and c) must be backwards-compatible with source code written for 15+ year old compilers. Plus, any breaking changes and thousands of books, reference manuals, online documentation, etc published over the last two decades would suddenly become WRONG.

    WCHAR is an interface—once it became published it was written in stone, even if it's not needed for new code.

提交回复
热议问题