Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 16 Aug 2001 11:10:53 +0100
From:      Mark Murray <mark@grondar.za>
To:        arch@freebsd.org
Subject:   Style 9 nitpicking question
Message-ID:  <200108161010.f7GAAsK68419@grimreaper.grondar.za>

next in thread | raw e-mail | index | archive | help
Hi

A piece of style(9) says:

<manpage_extract name=style sect=9>

     static void
     usage()
     {
	     /* Insert an empty line if the function has no local variables. */

     Use printf(3), not fputs/puts/putchar/whatever; it's faster and usually
     cleaner, not to mention avoiding stupid bugs.

[ snip ]

	 "usage: f [-aDde] [-b b_arg] [-m m_arg] req1 req2 [opt1 [opt2]]\n"
	 "usage: f [-a | -b] [-c [-dEe] [-n number]]\n"

	     (void)fprintf(stderr, "usage: f [-ab]\n");
	     exit(EX_USAGE);
     }

</manpage_extract>

Questions:

1) That "(void)" is useless by any metric that I am able to determine
   (WARNS=2, BDECFLAGS etc), and gets in the way of linting. Is there
   any reason to continue to advocate its use by this example? There
   is no other reference to "voiding-out" of return values.

2) Is this (fprintf(stderr, "...", ...); exit(n);) really better than
   errx(1, "...", ...); ?

Any objections to changing the 

	(void)fprintf(stderr, "usage: f [-ab]\n");
	exit(EX_USAGE);

to

	errx(EX_USAGE, "usage: f [-ab]\n");

??

M
-- 
Mark Murray
Warning: this .sig is umop ap!sdn

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




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