From owner-freebsd-current Thu Jan 28 03:40:41 1999 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id DAA02451 for freebsd-current-outgoing; Thu, 28 Jan 1999 03:40:41 -0800 (PST) (envelope-from owner-freebsd-current@FreeBSD.ORG) Received: from alpo.whistle.com (alpo.whistle.com [207.76.204.38]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id DAA02443 for ; Thu, 28 Jan 1999 03:40:39 -0800 (PST) (envelope-from julian@whistle.com) Received: (from daemon@localhost) by alpo.whistle.com (8.8.5/8.8.5) id DAA28482 for ; Thu, 28 Jan 1999 03:38:44 -0800 (PST) Received: from s204m82.isp.whistle.com(207.76.204.82) via SMTP by alpo.whistle.com, id smtpdg28479; Thu Jan 28 11:38:33 1999 Date: Thu, 28 Jan 1999 03:38:31 -0800 (PST) From: Julian Elischer X-Sender: julian@s204m82.isp.whistle.com To: current@FreeBSD.ORG Subject: Re: btokup().. patch to STYLE(9) (fwd) Message-ID: MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG Some people when confronted by people wanting to have extra braces say "change style(9)". Well, here is my change.. I think theere is enough support for this that this should be discussed seriously, and "It's not like in the good old days", or "I'm not used to extra parenthesis" are not going to be considerred as good reasons for not committing this.. Anyone can have reasons of that level. The aim to allow more braces and parens when needed for clarity. "Clarity" is decided by the person who get's confused because they ar enot there. Index: style.9 =================================================================== RCS file: /cvs/freebsd/src/share/man/man9/style.9,v retrieving revision 1.22 diff -u -r1.22 style.9 --- style.9 1997/12/07 20:25:45 1.22 +++ style.9 1999/01/28 09:07:46 @@ -256,13 +256,23 @@ .Ed .Pp Space after keywords (if, while, for, return, switch). No braces are -used for control statements with zero or only a single statement. +used for control statements with zero or only a single statement unless that +statement is more than a single line in which case they are permitted. Forever loops are done with for's, not while's. .Bd -literal -offset 0i for (p = buf; *p != '\e0'; ++p) ; /* nothing */ for (;;) stmt; + for (;;) { + z = a + really + long + statement + that + needs + + two lines + gets + indented + four + spaces + + on + the + second + and + subsequent + lines; + } + for (;;) { + if (cond) + stmt; + } if (val != NULL) val = realloc(val, newsize); .Ed @@ -290,7 +300,7 @@ and do not use spaces in front of tabs. .Pp Closing and opening braces go on the same line as the else. -Don't add braces that aren't necessary. +Braces that aren't necessary may be left out. .Bd -literal -offset 0i if (test) stmt; @@ -318,7 +328,8 @@ .Pp Unary operators don't require spaces, binary operators do. Don't use parentheses unless they're required for precedence, or the -statement is really confusing without them. +statement is confusing without them. Remember that other people may +confuse easier then you. Do YOU understand the following? .Bd -literal -offset 0i a = b->c[0] + ~d == (e || f) || g && h ? i : j >> 1; k = !(l & FLAGS); To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message