Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 2 Oct 2001 13:21:21 -0400
From:      Garance A Drosihn <drosih@rpi.edu>
To:        Bruce Evans <bde@zeta.org.au>, Ruslan Ermilov <ru@FreeBSD.ORG>
Cc:        Mark Murray <mark@grondar.za>, <arch@FreeBSD.ORG>
Subject:   Re: [Patch] style.9 nit
Message-ID:  <p05101001b7dfa59b0863@[128.113.24.47]>
In-Reply-To: <20011002212531.O87836-100000@delplex.bde.org>
References:  <20011002212531.O87836-100000@delplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
At 9:59 PM +1000 10/2/01, Bruce Evans wrote:
>
>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:
>%%%

This seems like a good clarification to make to the standard style(9).


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

For static routines (ones in a *.c source file), should any prototypes
at the top of the file include the exact argument names, without the
underscore?  Are the protected names only advisable for prototypes in
include files?

-- 
Garance Alistair Drosehn            =   gad@eclipse.acs.rpi.edu
Senior Systems Programmer           or  gad@freebsd.org
Rensselaer Polytechnic Institute    or  drosih@rpi.edu

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?p05101001b7dfa59b0863>