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: Jonas Trollvik <jontro@xxxxxxxxx>
Date: Thu, 7 Jul 2005 02:23:51 +0200

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@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
>




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