Enrico Forestieri wrote:

> On Sun, Nov 12, 2006 at 09:34:16PM +0100, Jean-Marc Lasgouttes wrote:
> 
>> This is not a regression for windows anyway, right?

No. On windows the code stays as broken as it is. It simply moves the
pressure to implement a working solution to those who care for windows.

> Yes, neither mingw nor cygwin have support for anything else than
> the C locale, and I doubt that MSVC has any, too.
> 
>> I'd say to put the
>> patch in, except that it might be better to define a
>> USE_LIBC_WCHAR_SUPPORT (or something more explicit) define instead of
>> +#if defined(HAVE_WCHAR_T) && SIZEOF_WCHAR_T == 4

Yes, I did that and put it in config.h. I did not use types.h, since what we
really need to know here is whether the wctype functions use UCS4 as
encoding. What we need to know in types.h is a bit different: We can use
wchar_t as char_type if it is wide enough. We do not care how libc
interprets wchar_t normally, because we do not use the libc functions
anywhere else than what I introduced.

> I tried to see whether the #ifdef's could be avoided altogether,
> and simply use the wctype functions anyway. This would be possible
> on cygwin, as the attached test program produces:
> 
> sizeof(wint_t) = 4
> towupper(97) = 65
> towupper(4294967295) = 4294967295
> 
> but it turned out that it is not possible with mingw, as the result was:
> 
> sizeof(wint_t) = 4
> towupper(97) = 65
> towupper(4294967295) = 65535

That test is not enough anyway. We can only use the wchar_t classification
functions from libc if wchar_t is a 32bit type and they use UCS4 as
encoding. Otherwise they would not do what we want.


Georg

Reply via email to