[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Coding Style: Function arguments on separate lines

From: Daniel Rall <dlr_at_collab.net>
Date: 2007-07-17 22:28:52 CEST

On Tue, 17 Jul 2007, Karl Fogel wrote:

> "Hyrum K. Wright" <hyrum_wright@mail.utexas.edu> writes:
> > After spending a while in various parts of our code base, I've noticed
> > an inconsistency between our declared coding style in HACKING, and
> > what we actually do. The following patch to HACKING makes it
> > congruent with our current practices. Comments?
>
> I think we actually go both ways, depending on how long the argument
> list is. Could you make hacking.html reflect that?

I like seeing the parameter-on-own line in the header files, which we
definitely tend towards doing. In the .c files (where function
definitions live), I'm less particular.

The patch below is a function definition though, rather than a
declaration.

> > [[[
> > * www/hacking.html
> > (coding-style): Emphasize our one-argument-per-line convention for
> > function declarations.
> > ]]]
> > Index: hacking.html
> > ===================================================================
> > --- hacking.html (revision 25767)
> > +++ hacking.html (working copy)
> > @@ -380,7 +380,8 @@
> >
> > <pre>
> > char * /* func type on own line */
> > - argblarg(char *arg1, int arg2) /* func name on own line */
> > + argblarg(char *arg1, /* func name on own line */
> > + int arg2) /* each arg on own line */
> > { /* first brace on own line */
> > if ((some_very_long_condition &amp;&amp; arg2) /* indent 2 cols */
> > || remaining_condition) /* new line before operator */

  • application/pgp-signature attachment: stored
Received on Tue Jul 17 22:28:01 2007

This is an archived mail posted to the Subversion Dev mailing list.