What's the best way to fix warnings from unused result

Eric S. Raymond esr at thyrsus.com
Mon Apr 8 21:05:20 UTC 2019


Fred Wright via devel <devel at ntpsec.org>:
> > This is probably what you want:
> > 
> > ./include/ntp_stdlib.h:162:#define IGNORE(r) do{if(r){}}while(0)
> 
> Does a simple void cast work?  E.g.:
> 
> 	(void) strerror_r(...)
> 
> It certainly works for unused function arguments, and it's an actual
> official language feature for explicitly discarding results.  Granted, I
> know of one compiler that doesn't like it, but it's an oddball.

Under recent versionn of GCC, it does not.  Compiler actually wants you
to *use* the returned value, not just discard it.
-- 
		<a href="http://www.catb.org/~esr/">Eric S. Raymond</a>




More information about the devel mailing list