Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 30 Jan 2002 20:26:45 -0500
From:      Garance A Drosihn <drosih@rpi.edu>
To:        Garrett Wollman <wollman@khavrinen.lcs.mit.edu>, Aviast@yahoo.com
Cc:        freebsd-standards@FreeBSD.ORG
Subject:   Re: casting functions to (void)
Message-ID:  <p05101221b87e4843719c@[128.113.24.47]>
In-Reply-To: <200201302216.g0UMG1Y64367@khavrinen.lcs.mit.edu>
References:  <20020130094110.16065.qmail@web14606.mail.yahoo.com> <200201302216.g0UMG1Y64367@khavrinen.lcs.mit.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
At 5:16 PM -0500 1/30/02, Garrett Wollman wrote:
><<On Wed, 30 Jan 2002 Michael Henry <aviast@yahoo.com> said:
>
>>  On another point: what is the general consensus on casting
>>  functions to void?
>
>I am of the opinion that it is silly.  Other reasonable people
>disagree.  (I happen to think that their reasons for disagreement
>are the result of inadequate tools, and the appropriate response
>is to fix the tool, not kluge up the source code.)

Speaking only to my own preference, I think it's worth doing in
the case where the function is returning some error indication,
and I "mean to" add code to check that error value at some point
in the (indefinite) future.  Later, if I'm trying to track down
some mysterious bug in that code, the (void) will stand out as a
good place to add more sanity-checks.

I think it's nuts on things like strcpy(), where I know the
function is returning a value, but that value is not needed by
anything the code is doing.  In that case, the (void) seems like
noise which just clutters up the code.

-- 
Garance Alistair Drosehn            =   gad@eclipse.acs.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-standards" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?p05101221b87e4843719c>