On Sun, Nov 12, 2006 at 09:34:16PM +0100, Jean-Marc Lasgouttes wrote:

> This is not a regression for windows anyway, right?

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

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

I don't know what happens with MSVC.

> I am not sure where it should be defined, though.

Isn't config.h the home of such things?

-- 
Enrico
#include <stdio.h>
#include <wchar.h>
#include <wctype.h>
#include <limits.h>

int main(void)
{
    printf("sizeof(wint_t) = %d\n", sizeof(wint_t));
    printf("towupper(97) = %d\n", towupper(97));
    printf("towupper(%u) = %u\n", UINT_MAX, towupper(UINT_MAX));
    return 0;
}

Reply via email to