Why does S5 lint dislike casts to long?
Jeff Dean
jeff at aids-unix
Thu Nov 22 09:13:14 AEST 1984
I don't have SysV, but: have you tried the "-a" option?
On AT&T versions of Unix (SysIII and after), it should
suppress error messages about long assignments.
In 4.1bsd, the "-a" option is reversed -- you use it to get
(not suppress) messages about long assignments. The error
message about incorrect sign extension is still there, but
apparently someone at Berkeley decided that the message
wasn't likely to be useful to anyone, and so it only comes
out if you use the "-a" option two (or more) times (this
is, of course, undocumented in the manual page).
lint definitely needs a way to handle "I know that's a
problem but I don't want to hear about it." Explicit casts
(when type conversion is the problem) are very good for
that purpose; the "lint comments" are also useful.
Unfortunately, there are instances where neither suffice.
I don't know of anyone who has come up with a better (more
general purpose) scheme for doing this. If you feel that
adding explicit casts is "cluttering" the code, you're
unlikely to find a generally acceptable solution. I'd say
that it is advantageous to explicitly mark any code that
fails to pass through a program checker (such as lint) to
assist future maintainers and others who may have to work
with the code.
jd
More information about the Comp.lang.c
mailing list