What's up with the windows headers?

Dmitry Olshansky dmitry.olsh at gmail.com
Wed Dec 26 14:41:27 PST 2012


12/27/2012 12:36 AM, Phil Lavoie пишет:
> You know what, I have browsed it a little bit and I think the choice to
> make aliases to A and W versions was the right one. I was thinking of
> adding a
> version( Unicode ) {
>    aliases here...
> }

Somewhat OT.
But IMHO almost any use of *A version is either a bug (unintended) or a 
legacy code. The OS kernel(Win2K+) works in UTF-16 (or rather an 
unchecked "superset" of it) via so called UNICODE_STRING** and it's even 
not NUL-terminated.

The fact that the horrible legacy MBCS API is still there is merely 
typical M$ kind of thing (leave the old rusty API working so that old 
software keeps crawling).

The fact that no new API calls come in *A variant alone should be a good 
food for a thought.

** See 
http://msdn.microsoft.com/en-us/library/windows/hardware/ff564879(v=vs.85).aspx
(the exact same thing comes up in various areas of MSDN)

Moving more firmly into OT realms:

What would have been nice is version of the same binding with UTF-8 auto 
converted to UTF16 and passed to *W calls. The most of text is in UTF-8 
anyway (and lot of stuff in D assumes simply 'string' i.e. UTF-8).
Thus we have 2 good things: newer API and cleaner text conversion (I 
won't be surprised in the least if it ends up to be faster then *A in 
some WINAPI calls).

-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list