bug-tar
[Top][All Lists]
Advanced

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

Re: [Bug-tar] minor warning glitch in tar 1.19 on Solaris 8 (sparc) with


From: Jan-Benedict Glaw
Subject: Re: [Bug-tar] minor warning glitch in tar 1.19 on Solaris 8 (sparc) with GCC 4.2.1
Date: Sat, 13 Oct 2007 08:54:05 +0200
User-agent: Mutt/1.5.13 (2006-08-11)

On Fri, 2007-10-12 22:50:16 -0700, Paul Eggert <address@hidden> wrote:
> 2007-10-12  Paul Eggert  <address@hidden>
> 
>       * 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      address@hidden              +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

[Prev in Thread] Current Thread [Next in Thread]