bug-gnulib
[Top][All Lists]
Advanced

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

Re: [PATCH] vasnprintf: avoid a warning from gcc -Wsign-compare


From: Jim Meyering
Subject: Re: [PATCH] vasnprintf: avoid a warning from gcc -Wsign-compare
Date: Wed, 15 Jun 2011 18:59:17 +0200

Paul Eggert wrote:
> On 06/15/11 08:17, Jim Meyering wrote:
>
>> +    vasnprintf: avoid a warning from gcc -Wsign-compare
>> +    * lib/vasnprintf.c (VASNPRINTF): Cast a known-positive quantity to
>> +    size_t in order to avoid a warning from gcc -Wsign-compare.
>
> Given that the context is this:
>
>                     if (count >= 0)
>                       {
>                         /* Verify that snprintf() has NUL-terminated its
>                            result.  */
>                         if (count < maxlen
>                             && ((TCHAR_T *) (result + length)) [count] != 
> '\0')
>                           abort ();
>
> wouldn't it be better to send the GCC maintainers a bug report?
> Since maxlen is unsigned, and since it is obvious to
> the compiler that count is nonnegative, there is no reason for
> a sign-compare warning here.

Yes, but that takes longer...
Thanks for the prod.
I've done it:

  http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49426



reply via email to

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