[Top][All Lists]

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

Re: [Bug-gnulib] xgetdomainname.c should include stdlib.h

From: Jim Meyering
Subject: Re: [Bug-gnulib] xgetdomainname.c should include stdlib.h
Date: Mon, 19 Apr 2004 19:20:33 +0200

Bruno Haible <address@hidden> wrote:
> Jim Meyering wrote:
>> >  /* Get errno.  */
>> >  #include <errno.h>
>> > +
>> > +/* Get free. */
>> > +#include <stdlib.h>
>> >
>> >  #include "xalloc.h"
>> BTW, wouldn't it be better without the `Get ...' comments?
>> The `Get errno.' one certainly doesn't add anything useful.
> Can you tell me one thing: When, after doing major changes to a source file,
> you want to clean up the #includes, how do you do that without comments?
> I've had the situation a few times where I asked myself whether <limits.h>
> is still needed, searched for *_MIN and *_MAX values, found none, removed
> the #include <limits.h> - and then got a compilation error because CHAR_BIT
> wasn't found.
> How do _you_ do such a cleanup?

I rarely try to identify unnecessary header files.
In the above example, would it really help to know that
stdlib.h was once included for the prototype of `free'?
What if the code was later changed to use abort (also in stdlib.h)
yet the comment wasn't updated accordingly?  Would it still help?
What if 10 functions from stdlib.h were used?

reply via email to

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