Is there any practical difference between WCHAR
and wchar_t
?
The type unsigned char is often used to represent a byte, which isn't a built-in type in C++. The wchar_t type is an implementation-defined wide character type.
wchar_t is used when you need to store a character over ASCII 255 , because these characters have a greater size than our character type 'char'. Hence, requiring more memory. It generally has a size greater than 8-bit character. The windows operating system uses it substantially.
wchar_t is unsigned. Corresponding assembly code says movzwl _BOM, %eax .
OLECHAR is the character type specifically used by COM (Component Object Model), a MSFT technology for creating platform independent objects (analogous to a C++ object but not tied to C++, though C++ is often used to create them - COM objects can be accessed by anyone who follows the COM protocol in any language or on ...
wchar_t
is a distinct type, defined by the C++ standard.
WCHAR
is nonstandard, and as far as I know, exists only on Windows. However, it is simply a typedef
(or possibly a macro) for wchar_t
, so it makes no practical difference.
Older versions of MSVC did not have wchar_t
as a first-class type—instead it was simply a typedef
for short
Most likely, Microsoft introduced WCHAR
to represent a "wide character type" across any compiler version, whether or not wchar_t
existed as a native type.
You should use wchar_t
in your code though. That's what it's for.
Well, one practical difference would be that WCHAR
doesn't exist on my platform. For Windows only (and with no intention of ever porting the program to another platform) and with the necessary headers included, it's the same (since WCHAR
is just a typedef
).
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With