[MPlayer-dev-eng] ctype.h functions on win32

Uoti Urpala uoti.urpala at pp1.inet.fi
Fri Oct 12 19:14:10 CEST 2007


On Fri, 2007-10-12 at 13:03 -0400, Rich Felker wrote:
> On Thu, Oct 11, 2007 at 07:03:23AM +0200, Gianluigi Tiesi wrote:
> > Win32 crt's ctype functions like isalpha isspace etc
> > are declared as int, but they return wrong results
> > (using msvc 2005, you get an assert or crash)
> > if the value is < 0
> 
> It's unclear from the spec what they're supposed to do. On the one
> hand it says the application shall ensure that the value passed is a
> valid value for unsigned char. But on the other hand, it says the
> functions shall return a nonzero value if the argument is a character
> of the corresponding type, and 0 otherwise (which could be interpreted
> as meaning that 0 should be returned for invalid values as well).

The C99 spec says about ctype.h functions "In all cases the argument is
an int, the value of which shall be representable as an unsigned char or
shall equal the value of the macro EOF. If the argument has any other
value, the behavior is undefined.". Not much unclear about that IMO.




More information about the MPlayer-dev-eng mailing list