Re: (void)fprintf(..) in style(9)
This is a multi-part message in MIME format.
--------------040706090609020902030605
Content-Type: text/plain; charset=us-ascii; format=flowed
Content-Transfer-Encoding: 7bit
Matthew Dillon wrote:
> :Max Okumoto wrote:
> :> Matt
> :>
> :> Can we change the (void)fprintf(...) example in the style(9) manual?
> :>
> :> Max
> :
> :Change by removing the (void). And make a comment indicating that
> :preference?
> :
> :
> : Max
>
> Yup, please do!
>
> -Matt
> Matthew Dillon
> <dillon@backplane.com>
Here is a patch to clarify what new code should not cast unused
return values of functions to void. Any comments?
Max
--------------040706090609020902030605
Content-Type: text/plain;
name="style.9.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: inline;
filename="style.9.patch"
Index: style.9
===================================================================
RCS file: /usr/data/DragonFly/dfly-cvs/src/share/man/man9/style.9,v
retrieving revision 1.16
diff -u -r1.16 style.9
--- style.9 31 Dec 2004 21:43:20 -0000 1.16
+++ style.9 28 Jan 2005 09:27:30 -0000
@@ -600,6 +600,8 @@
if (!*p)
.Ed
.Pp
+Do NOT cast the unused return value of a function to (void).
+.Pp
Routines returning
.Vt "void *"
should not have their return values cast
@@ -716,7 +718,7 @@
"usage: f [-a | -b] [-c [-dEe] [-n number]]\en"
.Ed
.Bd -literal
- (void)fprintf(stderr, "usage: f [-ab]\en");
+ fprintf(stderr, "usage: f [-ab]\en");
exit(EX_USAGE);
}
.Ed
--------------040706090609020902030605--