Discarded Function Values (To Cast or Not to Cast)
Duane Morse
duane at anasaz.UUCP
Sat Nov 18 09:49:31 AEST 1989
In article <316 at voa3.UUCP>, ck at voa3.UUCP (Chris Kern) writes:
[ My compiler (pcc) is agnostic about discarding the value from a
[ function call. Lint, of course, protests.
[ If it's my function, I presumably will declare it to be void if
[ it doesn't return a value and will use the value if it does return
[ one. But what about a standard library function whose value I
[ (perhaps recklessly) wish to ignore? Should I cast the function
[ call to void, or am I just indulging in the trivial luxury of
[ silencing lint?
We've found that lint catches programmer bugs often enough to make it
worthwhile to do the casts of standard library functions, so much so
that we require all programs to 'pass' lint before they can be released.
Lint can point out bugs that would take a programmer hours to find,
so we believe there's no excuse _not_ to use lint.
--
Duane Morse e-mail: duane at anasaz (or ... asuvax!anasaz!duane)
(602) 861-7609
More information about the Comp.lang.c
mailing list