From owner-freebsd-arch Tue Oct 2 5: 0:26 2001 Delivered-To: freebsd-arch@freebsd.org Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by hub.freebsd.org (Postfix) with ESMTP id 7E9C237B401; Tue, 2 Oct 2001 05:00:21 -0700 (PDT) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id WAA27100; Tue, 2 Oct 2001 22:00:16 +1000 Date: Tue, 2 Oct 2001 21:59:38 +1000 (EST) From: Bruce Evans X-X-Sender: To: Ruslan Ermilov Cc: Mark Murray , Subject: Re: [Patch] style.9 nit In-Reply-To: <20011002114936.L74839@sunbay.com> Message-ID: <20011002212531.O87836-100000@delplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII 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 On Tue, 2 Oct 2001, Ruslan Ermilov wrote: > On Mon, Oct 01, 2001 at 05:48:42PM +0100, Mark Murray wrote: > > Hi > > > > Any objections to this patch? Yes. > > It removes argument names from an example function prototype > > to match a previously mentioned guideline about such names. > > > > eg: > > > > int foo(int bar); > > > > becomes > > > > int foo(int); > > > Hmm, what's wrong with this? > > : In header files visible to userland applications, prototypes that are > : visible must use either protected names or no names with the types. It > : is preferable to use protected names. E.g., use: My version of style.9 clarifies this a little: %%% Index: style.9 =================================================================== RCS file: /home/ncvs/src/share/man/man9/style.9,v retrieving revision 1.66 diff -u -2 -r1.66 style.9 --- style.9 1 Oct 2001 16:13:59 -0000 1.66 +++ style.9 2 Oct 2001 10:59:56 -0000 @@ -238,5 +293,7 @@ .Pp In header files visible to userland applications, prototypes that are -visible must use either protected names or no names with the types. It +visible must use either +.Dq Li protected +names (ones beginning with an underscore) or no names with the types. It is preferable to use protected names. E.g., use: %%% > : > : void function(int); > : > : or: > : > : void function(int _fd); > > Your diff actually changes: > > int foo(int _bar); > > to > > int foo(int); > > which is acceptable prototype with "protected" names. Except this changes from the preferred form to the unpreferred one. The diff is actually a little different: > > -static char *function(int _arg, const char *_arg2, struct foo *_arg3, > > - struct bar *_arg4); > > +static char *function(int, const char *, struct foo *, struct bar *); Since the function is static, this example is bad for other reasons. Namespace pollution is almost irrelevant. The function proper must have certain arg names and those should normally not begin with an underscore or shadow any more global names. The function prototype can use the same names. Bruce To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-arch" in the body of the message