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

Rich Felker dalias at aerifal.cx
Fri Oct 12 20:24:53 CEST 2007


On Fri, Oct 12, 2007 at 08:14:10PM +0300, Uoti Urpala wrote:
> 
> 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.

OK, I read POSIX and I think it was less clear. Sorry about that.

Rich



More information about the MPlayer-dev-eng mailing list