On Fri, 2007-10-12 22:50:16 -0700, Paul Eggert <[EMAIL PROTECTED]> wrote:
> 2007-10-12  Paul Eggert  <[EMAIL PROTECTED]>
> 
>       * src/utf8.c (string_ascii_p): Recode to avoid bogus GCC 4.2.1
>       warning about "comparison is always true due to limited range of
>       data type" when char is unsigned.
> 
> --- src/utf8.c        27 Jun 2007 13:30:15 -0000      1.10
> +++ src/utf8.c        13 Oct 2007 05:49:15 -0000
> @@ -91,7 +91,7 @@ bool
>  string_ascii_p (char const *p)
>  {
>    for (; *p; p++)
> -    if (! (0 <= *p && *p <= 127))
> +    if (*p & ~0x7f)
>        return false;
>    return true;
>  }
> 

The `char' type, in difference to all other integer type, has no
default signedness. On some compilers, "char" is "signed char", on
others, it's a "unsigned char".  To really keep readability, I'd
rather have a local unsigned char variable and operate on it with
if (*foo >= 127) return false.

MfG, JBG

-- 
      Jan-Benedict Glaw      [EMAIL PROTECTED]              +49-172-7608481
Signature of:         "really soon now":      an unspecified period of time, 
likly to
the second  :                                 be greater than any reasonable 
definition
                                              of "soon".

Attachment: signature.asc
Description: Digital signature

Reply via email to