DragonFly BSD
DragonFly submit List (threaded) for 2005-01
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: (void)fprintf(..) in style(9)


From: Max Okumoto <okumoto@xxxxxxxx>
Date: Fri, 28 Jan 2005 01:34:11 -0800

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@xxxxxxxxxxxxx>

Here is a patch to clarify what new code should not cast unused return values of functions to void. Any comments?

Max
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


[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]