ctype bug

Matthew Dillon dillon at apollo.backplane.com
Wed Jul 6 17:16:42 PDT 2005


: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





More information about the Commits mailing list