From owner-cvs-all Fri Sep 28 14:15: 3 2001 Delivered-To: cvs-all@freebsd.org Received: from gateway.posi.net (c1096725-a.smateo1.sfba.home.com [24.250.130.228]) by hub.freebsd.org (Postfix) with ESMTP id 3A6DD37B408; Fri, 28 Sep 2001 14:14:56 -0700 (PDT) Received: from localhost (kbyanc@localhost) by gateway.posi.net (8.11.3/8.11.3) with ESMTP id f8SLEGh97740; Fri, 28 Sep 2001 14:14:16 -0700 (PDT) (envelope-from kbyanc@posi.net) X-Authentication-Warning: gateway.posi.net: kbyanc owned process doing -bs Date: Fri, 28 Sep 2001 14:14:15 -0700 (PDT) From: Kelly Yancey To: Julian Elischer Cc: Garrett Wollman , obrien@FreeBSD.org, cvs-committers@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/sys/sys proc.h In-Reply-To: Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG 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