bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/5] win32: Use ANSI functions


From: Bruno Haible
Subject: Re: [PATCH 1/5] win32: Use ANSI functions
Date: Fri, 2 Oct 2009 01:47:52 +0200
User-agent: KMail/1.9.9

Hi Paolo,

> This first one uses ANSI functions whenever we're passing or receiving
> strings, so that compiling with -DUNICODE succeeds.  ... Ok?

I object, for the reason of maintainability of code.

1) Ability to look up the documentation. The next developers to maintain
   this code should be able to google the function names and use the
   names that are commonly in use.
2) It adds complexity to have to think at every Win32 function call:
   "does this function need an A suffix or not?" GetVersionEx yes,
   GetVersion no. There is a systematic way to find out - look in the
   mingw headers - but it takes up extra time.

Being able to use the 'ANSI' family of Win32 functions with -DUNICODE
is a non-goal. Win32 headers use -DUNICODE to denote which family of
Win32 functions to use. GNU clisp uses -DUNICODE to denote whether
to support Unicode characters. Two totally different meanings.

It would be best if clisp would change its macro 'UNICODE' to
'ENABLE_UNICODE'. clisp's win32.d already contains a workaround:

  #ifdef UNICODE
    #define UNICODE_SAVED
    #undef UNICODE
  #endif

Yes it was me who used this macro 10 years ago, thinking that I would
be stronger than Microsoft. Ha! I was in a stubborn age. Now I'm in a
wiser age.

In other words, clisp's idiosyncraties should be confined to clisp, and
not be exported into gnulib.

> -  HMODULE kernel32 = LoadLibrary ("kernel32.dll");
> +  HMODULE kernel32 = GetModuleHandleA ("kernel32.dll");

The change LoadLibrary -> GetModuleHandle is fine here. Good point.

Bruno




reply via email to

[Prev in Thread] Current Thread [Next in Thread]