Subject: Re: ignoring return values from functions.
To: NetBSD Userlevel Technical Discussion List <tech-userlevel@netbsd.org>
From: Andrew Brown <atatat@atatdot.net>
List: tech-userlevel
Date: 09/19/2001 23:24:16
>> Casting return values to (void) is even explicitly discouraged by
>> several style guides and probably stems from the use of some checking
>> tools (some versions of lint perhaps?) and compilers which were a bit
>> overzealous with things...
>
>I would consider such style guides VERY misguided.  Lint in particular
>is very correct in complaining about such errors and it's advice should
>be taken if at all possible!

lint and the c compiler sometimes disagree.  some things, like the use
of NOTREACHED to aid lint in determining that a block of code is
ending seem bogus.  the c compiler knows, and the use of __dead can be
good thing.

>It is ALWAYS best to explicitly cast function return values to (void) if
>they are expliicltly to be ignored.  We're not talking about the basic
>correctness of the code here, but rather the readability and future
>maintainability of the code.

i really don't think it helps the readability of the code.  then
again, if i wish to, i can make things much unreadable anyway by using
!! and -~ or ~-.

-- 
|-----< "CODE WARRIOR" >-----|
codewarrior@daemon.org             * "ah!  i see you have the internet
twofsonet@graffiti.com (Andrew Brown)                that goes *ping*!"
andrew@crossbar.com       * "information is power -- share the wealth."