ctype bug

Jonas Trollvik jontro at gmail.com
Wed Jul 6 17:24:39 PDT 2005


I think 0xff does represent the currency sign in Cyrillic/Russian, Im
not sure if this applies to isprint though.

On 7/7/05, Matthew Dillon <dillon at xxxxxxxxxxxxxxxxxxxx> wrote:
> 
> :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