🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: comp.lang.c.moderated
Article #2070

Re: Casting to (void)

#2070
From: Larry Weiss
Date: Sun, 25 Feb 1996 17:58
20 lines
1351 bytes
Thomas A. Stolz wrote:
 > 
 > Several of my coworkers have recently brought to my attention published code
 > which always casts unused return values to (void).  For example, this code
 > would use the statement:
 >         (void)strcpy( dest, src );
 > rather than the statement:
 >         strcpy( dest, src );
 > I see no advantage in using the cast.  In fact, I would tend to believe it
 > would make the code harder to read, especially for inexperienced programmers.


If used consistently, then I can get used to the style of coding where one
constantly "disposes" of a returned value by casting to void.   It's certainly
an education for the unexperienced in such a style (but a trivial technique to
learn).

The main reason I've seen programmer's use this style is to quiet the "lint"
checkers.   I don't naturally code this way, but can certainly read code in
this style without losing comprehension.
Technical Details
Message-ID: <4gq80h$oke@solutions.solon.com>
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
References: <4gnb5s$bed@solutions.solon.com>

Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!solon.com!not-for-mail
From: Larry Weiss <lfw@iadfw.net>
Newsgroups: comp.lang.c.moderated
Subject: Re: Casting to (void)
Date: 25 Feb 1996 11:58:41 -0600
Organization: ---
Sender: clc@solutions.solon.com
Approved: clc@solutions.solon.com
Message-ID: <4gq80h$oke@solutions.solon.com>
References: <4gnb5s$bed@solutions.solon.com>
NNTP-Posting-Host: solutions.solon.com
X-Mailer: Mozilla 2.0 (Win16; I)