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