From owner-freebsd-arch Thu Aug 16 12:18:17 2001 Delivered-To: freebsd-arch@freebsd.org Received: from arb.arb.za.net (arb.arb.za.net [196.7.148.4]) by hub.freebsd.org (Postfix) with ESMTP id 843A237B408 for ; Thu, 16 Aug 2001 12:18:09 -0700 (PDT) (envelope-from mark@grondar.za) Received: (from uucp@localhost) by arb.arb.za.net (8.11.3/8.11.3) with UUCP id f7GJHrE49651; Thu, 16 Aug 2001 21:17:53 +0200 (SAST) (envelope-from mark@grondar.za) Received: from grondar.za (localhost [127.0.0.1]) by grimreaper.grondar.za (8.11.5/8.11.4) with ESMTP id f7GFpLK72129; Thu, 16 Aug 2001 16:51:22 +0100 (BST) (envelope-from mark@grondar.za) Message-Id: <200108161551.f7GFpLK72129@grimreaper.grondar.za> To: Bruce Evans Cc: arch@FreeBSD.ORG Subject: Re: Style 9 nitpicking question References: <20010817005031.S29341-100000@besplex.bde.org> In-Reply-To: <20010817005031.S29341-100000@besplex.bde.org> ; from Bruce Evans "Fri, 17 Aug 2001 01:16:37 +1000." Date: Thu, 16 Aug 2001 16:51:20 +0100 From: Mark Murray Sender: owner-freebsd-arch@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG > > 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. > > It by prevents warnings like the following from `lint -h': > > "snprintf returns a value which is sometimes ignored" > "snprintf returns a value which is always ignored" Hmm - in the linting that I have done, I've told lint that ignoring the return value of ${THESE} functions is OK. (THESE = str* *printf, *scanf and a few others) > This is the opposite of getting in the way of linting. Sorta :-) Its often not a useful warning (most particularly for certain functions), and the (void) cast offends me because it is useless and obfuscating. > > 2) Is this (fprintf(stderr, "...", ...); exit(n);) really better than > > errx(1, "...", ...); ? > > Yes. The former is more portable, and prints the program name in the > usual place (after "usage: "). OK. > > Any objections to changing the > > > > (void)fprintf(stderr, "usage: f [-ab]\n"); > > exit(EX_USAGE); > > > > to > > > > errx(EX_USAGE, "usage: f [-ab]\n"); > > Yes :-). The second form here has the additional bug of printing the > program name twice (perhaps different names if the binary is linked). OK. 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