[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: Eric Blake
Subject: Re: [PATCH 1/2] inet_ntop: silence gcc warning
Date: Thu, 12 Jan 2012 08:36:45 -0700
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:9.0) Gecko/20111222 Thunderbird/9.0

On 01/12/2012 05:04 AM, Jim Meyering wrote:
> Eric Blake wrote:
>> On 01/11/2012 04:44 PM, Paul Eggert wrote:
>>> On 01/11/12 15:24, Eric Blake wrote:
>>>> +  best.len = 0;
>>> I have some qualms about adding unnecessary initializations
>>> merely to silence GCC.  It's not just that it bloats the
>>> runtime -- it's that it makes the code more confusing, because
>>> later readers might mistakenly assume that the initializations
>>> are necessary, which might cause them to waste time trying to figure
>>> out why the initializations are there.
>>> How about if we put that assignment inside an "#ifdef lint",
>>> or wrap it in IF_LINT, or something like that?  That should
>>> make it clearer and avoid the runtime bloat.
>> But putting it inside #ifdef lint means you won't solve the compilation
>> warning in the default case.  And in this case, it took me several
> There are already numerous uses of IF_LINT and "#ifdef lint" in gnulib,
> so users of gnulib who enable warning options should not be surprised
> by warnings when they neglect to use -Dlint.
> It is good for maintainability to mark such an unnecessary initialization.

Fair enough.  I'll convert this to use a LINT check, and update libvirt
(which was the initial client to detect the warning) to turn on -Dlint
when using full warnings.

Eric Blake   address@hidden    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature

reply via email to

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