[Top][All Lists]

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

Re: [PATCH 1/2] inet_ntop: silence gcc warning

From: Paul Eggert
Subject: Re: [PATCH 1/2] inet_ntop: silence gcc warning
Date: Wed, 11 Jan 2012 20:51:30 -0800
User-agent: Mozilla/5.0 (X11; Linux i686; rv:8.0) Gecko/20111124 Thunderbird/8.0

On 01/11/12 16:01, Eric Blake wrote:
> putting it inside #ifdef lint means you won't solve the compilation
> warning in the default case.

In the default case, GCC doesn't warn, right?
That is, it warns only if you enable some flags such as -Wall?
If so, it's OK if we ask people who set such flags to also use
-Dlint.  I think --enable-gcc-warnings does that by default,
with coreutils.

> it took me several minutes of staring at the code to see
> _why_ the variable was never used uninitialized

All the more reason to mark the assignment as one needed
for lint checking.  That way, it's clear that the assignment
is there to silence GCC, and that GCC wasn't smart enough to
figure it out, and this is a good cue that it's a nontrivial
relationship.  Without the marking, this useful info is lost.

This kind of marking is standard in coreutils and GNU Emacs,
and my impression is that it works reasonably well there.

reply via email to

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