DragonFly BSD
DragonFly commits List (threaded) for 2005-07
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: ctype bug


From: Matthew Dillon <dillon@xxxxxxxxxxxxxxxxxxxx>
Date: Wed, 6 Jul 2005 17:15:41 -0700 (PDT)

:i'd say, make it a compile time flag. we can't assert, that's true, but
:we could *(int*)0 =3D 1 or something like this.

    No, we have to decide one way or the other.

:> +static __inline int
:> +__libc_ctype_index(__uint16_t mask, int c)
:> +{
:> +	if (c < -1 || c >=3D _CTYPE_NUM_CHARS)
:> +		return(0);
:
:how about folding the argument? this way passing an signed char
:actually works like "expected":
:
:int i =3D 0xad;	/* euro sign (?) */
:char c =3D i;
:printf("%c %c %d %d\n", i, c, isprint(i), isprint(c));
:
:should print "? ? 1 1", and not "? ? 1 0". or maybe it's too late
:and i'm missing something.

    Yes, right you are.  The standards folks screwed it all up even
    allowing EOF to be passed, does 0xFF translate to anything real
    in Euroland ?

						-Matt



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