Path: utzoo!attcan!uunet!samsung!zaphod.mps.ohio-state.edu!ncar!ico!haddock!karl From: karl@haddock.ima.isc.com (Karl Heuer) Newsgroups: comp.lang.c Subject: Re: Why use (void) func() ? (lint beef) Message-ID: <18451@haddock.ima.isc.com> Date: 8 Oct 90 03:36:43 GMT References: <586@dptechno.UUCP> <1990Sep24.193012.14074@diku.dk> <12141@crdgw1.crd.ge.com> <151806@felix.UUCP> <1014@gistdev.gist.com> Reply-To: karl@kelp.ima.isc.com (Karl Heuer) Organization: Interactive Systems, Cambridge, MA 02138-5302 Lines: 40 In article <151806@felix.UUCP> asylvain@felix.UUCP (Alvin E. Sylvain) writes: >In article <12141@crdgw1.crd.ge.com> volpe@underdog.crd.ge.com (Christopher R Volpe) writes: >>It fails to warn about ignored return values from *my* routines, and >>always warns about ignored return values from printf and scanf! > >I agree with this assessment of lint... As I pointed out to Chris V. by email, it's not true that lint distinguishes between user functions and library functions this way. And of course lint has no way of knowing the difference between a critical printf() call and a benign one, unless you tell it (see my example of enclosing the former in a routine that *does* check the return value). >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. The particular issue mentioned above is a single item at the bottom of the lint output--easy enough to visually skip past. If you're going to complain about inappropriate lint verbosity, complain about the malloc() bug, which yields a warning on every call. In article <1014@gistdev.gist.com> flint@gistdev.gist.com (Flint Pellett) writes: >1. An option to ignore extern declarations made in a .h that aren't used. > (Ever run lint on something that #includes ? You get to wade > through 3 pages of curses routines that were extern'ed but not used.) Assuming you remember to specify "-lcurses", what you are observing is a bug in and/or llib-lcurses. Report it to your vendor. > The same goes for declarations I put in my own .h files. > Now if I have an extern right there in the file that I haven't used, I > want to know about that, but if it's in some .h, who cares? If the object being declared extern doesn't have a corresponding definition anywhere, then why does your header declare it? If a defining declaration does exist but is not visible to lint (because you're linting only some of the files), then you should be using the lint options that say so. Karl W. Z. Heuer (karl@kelp.ima.isc.com or ima!kelp!karl), The Walking Lint