Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 03 Oct 2001 09:20:56 +0100
From:      mark@freebsd.org
To:        Mike Smith <msmith@freebsd.org>
Cc:        arch@freebsd.org
Subject:   Re: [Patch] style.9 nit 
Message-ID:  <200110030820.f938KvA47987@grimreaper.grondar.za>
In-Reply-To: <200110022325.f92NPSt02665@mass.dis.org> ; from Mike Smith <msmith@freebsd.org>  "Tue, 02 Oct 2001 16:25:28 PDT."
References:  <200110022325.f92NPSt02665@mass.dis.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
> > Hi
> > 
> > Any objections to this patch?
> > 
> > It removes argument names from an example function prototype
> > to match a previously mentioned guideline about such names.
> 
> This is a bit of a contentious issue.  Personally, I find it useful to be 
> able to tell what the argument(s) to a function are from the prototype.

Ok - I like the protected name approach (int foo (int _bar) instead of
int foo(int bar) ). Does that work for you?

The namespace pollution I refer to is WARNS=2 complaints about variable
"bar" overriding a global/previous definition.

> All this really saves us from would be, in your example, someone 
> redefining 'bar' with a preprocessor macro; something they typically 
> shouldn't be doing anyway (based on other guidelines).
> 
> For documented functions that are part of a public interface and consumed 
> by third-party code, I think this is a good idea.  For other code, I'm 
> less sure about it.

I'd like to protect the argument names in header files that are causing
WARNS=2 breakage.

M


> > eg:
> > 
> > int foo(int bar);
> > 
> > becomes
> > 
> > int foo(int);
> > 
> > This helps quite a bit in reducing namespace pollution.
> > 
> > M
> > 
> > Index: style.9
> > ===================================================================
> > RCS file: /home/ncvs/src/share/man/man9/style.9,v
> > retrieving revision 1.66
> > diff -u -d -r1.66 style.9
> > --- style.9	1 Oct 2001 16:13:59 -0000	1.66
> > +++ style.9	1 Oct 2001 16:39:38 -0000
> > @@ -252,8 +252,7 @@
> >  Prototypes may have an extra space after a tab to enable function names
> >  to line up:
> >  .Bd -literal
> > -static char	*function(int _arg, const char *_arg2, struct foo *_arg3,
> > -		    struct bar *_arg4);
> > +static char	*function(int, const char *, struct foo *, struct bar *);
> >  static void	 usage(void);
> >  
> >  /*
> > 
> > To Unsubscribe: send mail to majordomo@FreeBSD.org
> > with "unsubscribe freebsd-arch" in the body of the message
> 
> -- 
> ... every activity meets with opposition, everyone who acts has his
> rivals and unfortunately opponents also.  But not because people want
> to be opponents, rather because the tasks and relationships force
> people to take different points of view.  [Dr. Fritz Todt]
>            V I C T O R Y   N O T   V E N G E A N C E
> 
> 
-- 
o       Mark Murray
\_      FreeBSD Services Limited
O.\_    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?200110030820.f938KvA47987>