Why use (void) func() ? (lint beef)

Alvin E. Sylvain asylvain at felix.UUCP
Tue Oct 2 09:42:05 AEST 1990


In article <12141 at crdgw1.crd.ge.com> volpe at underdog.crd.ge.com (Christopher R Volpe) writes:
>I wouldn't mind it if lint warned about *my* functions that I declare
>with a return value which I *sometimes* ignore. That makes sense, because
>I rarely define functions whose return values I am interested in only
>sometimes. What I do mind is when lint warns me about return values from
>printf being ignored, which I, as well as most people, routinely ignore.
>Our dain-bramaged lint does the annoying thing in both circumstances:
>It fails to warn about ignored return values from *my* routines, and
>always warns about ignored return values from printf and scanf! 
>==================
>Chris Volpe
>G.E. Corporate R&D
>volpecr at crd.ge.com

I agree with this assessment of lint, and I'd like to open the floor
to opinions in that area.  I believe this is the main bone of contention
here.  IMHO, lint is a good idea, but it is usually so durnedably
verbose that I'd rather not bother.  It's a matter (as expressed above)
of reporting problems one could just as well not hear about.

Any tool which annoys the user to the point of not using it is less
than useless ... the benefits are wasted.  In the case of lint, real
problems can remain uncovered, only to bite you during testing,
maintenance, or (ye gads!) customer operation.

Anyone else out there feel this way?  Any thoughts toward a version
of lint that's a little less "mother-hen", but still tells you what
you need to know?  Maybe we could program it with "ignore the following
problems with the following functions" instructions.

(BTW, even if you never check printf, IMAO you should *always* check scanf.
Your output may be 99% reliable if the file was opened successfully,
but your input is *always* suspicious, no matter what the source.)
--
------------------------------------------------------------------------
"I got protection for my    |               Alvin "the Chipmunk" Sylvain
affections, so swing your   |   Natch, nobody'd be *fool* enough to have
bootie in my direction!"    |   *my* opinions, 'ceptin' *me*, of course!
-=--=--=--"BANDWIDTH??  WE DON'T NEED NO STINKING BANDWIDTH!!"--=--=--=-



More information about the Comp.lang.c mailing list