Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 28 Sep 2001 14:14:15 -0700 (PDT)
From:      Kelly Yancey <kbyanc@posi.net>
To:        Julian Elischer <julian@elischer.org>
Cc:        Garrett Wollman <wollman@khavrinen.lcs.mit.edu>, obrien@FreeBSD.org, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/sys proc.h
Message-ID:  <Pine.BSF.4.21.0109281251330.97648-100000@gateway.posi.net>
In-Reply-To: <Pine.BSF.4.21.0109271716250.65838-100000@InterJet.elischer.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 27 Sep 2001, Julian Elischer wrote:

> 
> Personally I'd like to see something that says like:
> 
> "small variations to this rule, for the purpose of aligning
> related fields and increasign readability are accepteble."
> 
> and maybe an example
> 
> struct foo {
> 	int		foo_a;		/* comment */
> 	struct freddy	foo_b;		/* Comment aligned as above. */
> 	union bigwords	*foo_c;		/* All comments aligned */
> 	unsigned char	foo_chars;	/* to allow the eye to scan them */
> 					/* With overflow also aligned */
> 					/* the same as above. */
> 	struct bigstructures foo_vals[NUMSTRUCTS]; /* sometimes you just */
> 					/* have to bend the rules */
> };
> 

  This is the style most agreeable with me. But I must point out that
style(9) is even further from this than it has ben recognized for.
Specifically, the clause and examples indicating a tab after the first
word. So your example when style(9)ified becomes:

struct foo {
	int	foo_a;			/* Comment. */
	struct	freddy foo_b;		/* Comment aligned as above. */
	union	bigwords *foo_c;	/* All comments aligned. */
	unsigned	char foo_chars;	/* Aligned so the eye to scan them. */
	struct	bigstructures foo_vals[NUMSTRUCTS]; /* Sometimes you just */
					/* have to bend the rules. */
};

  Assuming the purpose of style(9) is to produce consistent code that is easy
to read, it should be obvious the current guidelines fail in the case of
structures. Note that there is no rule requiring comments to be one tab after
the semicolon or whatnot, presumably because that would make the code
impossible to read. Instead, we are allowed to start comments on whatever
column makes them easiest to read. So why not allow the same developer
discretion in the case of structure member names?
  At the very least, I cannot fathom what is gained by putting the tab after
the first word rather than after the complete data type with modifiers.

  Just my 2 cents,

  Kelly

--
Kelly Yancey  -  kbyanc@posi.net  -  Belmont, CA
Lead Engineer, Backplane, Inc.                   http://www.backplane.com/
Maintainer, BSD Driver Database       http://www.posi.net/freebsd/drivers/
Coordinator, Team FreeBSD        http://www.posi.net/freebsd/Team-FreeBSD/


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.21.0109281251330.97648-100000>