Updates to the WindowsAPI translation instructions; D2 only?

Sönke Ludwig sludwig at outerproduct.org
Thu Aug 1 22:51:44 PDT 2013


Am 01.08.2013 22:59, schrieb Stewart Gordon:
> - Define a mixin template along the lines of __AW in newer versions of
> MinGW, so that
>
>      version (Unicode) {
>          alias QwertW Qwert;
>      } else {
>          alias QwertA Qwert;
>      }
>
> can become simply
>
>      mixin DECLARE_AW!("Qwert");
>

I would seriously take into consideration to just drop the "A" versions. 
D is unicode by nature, the "W" versions are supported by all NT systems 
(since Windows 95 using MSLU), and using an ANSI version of a function 
also just begs for bugs if typed as "char*" instead of "ubyte*". Many 
newer functions also just have a single wide string variant.

IMO this is just legacy cruft that was maybe still useful in times when 
supporting Windows 95 was important and MSLU had to be installed as an 
explicit add-on, but for nothing else really (although frequently used 
in C programs because it saves typing an additional character: "" vs. 
L"" or even _T("")).

Also switching API based on a version statement always introduces a 
chance to break interoperability of two libraries that require the 
version to be set differently.

The issue here of course is breaking existing code that doesn't use the 
"Unicode" path. Not sure how serious this is, though...


More information about the Digitalmars-d mailing list