From owner-freebsd-arch Thu Aug 16 3:35: 5 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 D031E37B40D for ; Thu, 16 Aug 2001 03:34:58 -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 f7GAYvu01926 for arch@freebsd.org; Thu, 16 Aug 2001 12:34:57 +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 f7GAAsK68419 for ; Thu, 16 Aug 2001 11:10:54 +0100 (BST) (envelope-from mark@grondar.za) Message-Id: <200108161010.f7GAAsK68419@grimreaper.grondar.za> To: arch@freebsd.org Subject: Style 9 nitpicking question Date: Thu, 16 Aug 2001 11:10:53 +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 Hi A piece of style(9) says: 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); } 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