Discarded Function Values (To Cast or Not to Cast)

Chris Kern ck at voa3.UUCP
Fri Nov 17 05:58:51 AEST 1989


I suspect this is not a novel inquiry, but I can't remember any
previous discussion. . . .

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?

-- 
Chris Kern			     Voice of America, Washington, D.C.
...uunet!voa3!ck					+1 202-485-7020



More information about the Comp.lang.c mailing list