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

Max Okumoto okumoto at ucsd.edu
Fri Jan 28 01:34:11 PST 2005


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 at 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




More information about the Submit mailing list