I'm a little confused now with the hungarian notation prefixes in WinAPI for CHAR strings and WCHAR strings. When we use a CHAR string usually such a prefix is used:
CHAR szString[] = "Hello";
We have a zero-terminated string szString so everything's fine. But when we use a WCHAR string usually such a prefix is used:
WCHAR pwszString[] = L"Hello";
It stands for pointer to zero-terminated wide string... but our type doesn't look like this. Pointer to zero-terminated wide string is WCHAR** or PWSTR*. Am I wrong? Why it's sz for CHAR strings and pwsz but not wsz for WCHAR strings?
The second example is misleading (though not uncommon). It should be either one of these two:
WCHAR wszString[] = L"Hello";
WCHAR *pwszString = L"Hello";
Since an array can be used in most contexts that a pointer is expected, some programmers get a little sloppy about the distinction.
Hungarian is out of style, but it can be useful when used well.
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