Subject: Re: ARGSUSED and friends
To: None <firstname.lastname@example.org>
From: der Mouse <mouse@Rodents.Montreal.QC.CA>
Date: 01/18/2000 01:44:05
> OK - it's good to make code pass lint. Lint has pulled out lurking
> bugs that gcc did not flag with -Wall, though that may be more a
> problem with -Wall than anything else.
Quite aside from whether this has anything to say about -Wall, those
two statements are not equivalent. If lint has pulled out lurking
bugs, that's a reason to use lint and read over the results; it is not
necessarily a reason to arrange that lint be silent about them.
I'd also not recommend -Wall alone; it does *not* turn on all warnings!
My preferred set of options is -Werror -W -Wall -Wpointer-arith
-Wcast-qual -Wwrite-strings -Wstrict-prototypes -Wmissing-prototypes
-Wno-uninitialized -Wno-sign-compare -Wno-missing-init, of which
-Wno-missing-init is due to my own patches (there's no way to turn off
the missing-initializer warning when using -W -Wall otherwise).
>> [I've used lint too] but I've never gone to the trouble to eliminate
>> every last gripe, because some are just too silly (such as the
>> dreadful "pointer casts can be troublesome" - franchement, if you
>> can't even cast pointers without upsetting lint, it's hard to write
>> anything useful.
> I thought it threw those out when you cast a pointer to an int.
Then the message is atrociously worded. :-) This also doesn't match a
small test I just did:
[Sparkle] 28> cat z.c
d = 7.41;
[Sparkle] 29> lint -chp z.c
z.c(6): warning: pointer casts may be troublesome
printf returns value which is always ignored
Changing the cast to (int) produces instead
z.c(6): warning: conversion of pointer to 'int' may lose bits
(with no printf declaration, I don't expect lint to produce anything
equivalent to gcc -Wformat's warning for the "%d" vs (char *) thing).
> It is a valid complaint to make considering that
> (sizeof(int) == sizeof(void*)) does not evaluate to true on all
> architectures ;-)
gcc has a warning along the lines of "cast from pointer to integer of
different size" (and another one in the other direction); safe casts
between pointers and integers are a little too useful for me to want to
pitch them entirely.
7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B