questions from using lint

Gary M. Samuelson garys at bunkerb.UUCP
Wed May 14 03:35:00 AEST 1986


In article <797 at bentley.UUCP> kwh at bentley.UUCP (KW Heuer) writes:

>[2] close(), as near as I can tell, can only fail by being handed a number
>    that does not denote an open file.  I usually assume that this error
>    would have been caught earlier.

Assuming a buffered device, the last block of data will not be physically
written until close(), in which case nearly all of the errors possible with
write() could occur with close().

>[3] unlink() and most other system calls should be checked!  (It's too bad
>    lint can't tell whether you've tested the return value of open(), etc.)

??? Lint certainly can check for that (at least the lint I use); it says
something like "open returns value which is sometimes ignored" (or
"always", as the case may be).  It does this by checking the definition
of open() in /usr/lib/lint

>"lint returns an error which is always ignored" :-)

This is going to my collection of classic quotes.

>From Jim Cotrl (yes, I know the spelling is wrong, but after all,
think of all the keystrokes I saved):
>>And as someone pointed out, assignments return a value too, so should we
>>cast them to void as well?  Oh yeah, assignment is `different'.

If I say "a = b", I have clearly used the value of the expression.

Gary Samuelson



More information about the Comp.lang.c mailing list