Date: Thu, 28 Jan 1999 03:38:31 -0800 (PST) From: Julian Elischer <julian@whistle.com> To: current@FreeBSD.ORG Subject: Re: btokup().. patch to STYLE(9) (fwd) Message-ID: <Pine.BSF.4.05.9901280335450.304-100000@s204m82.isp.whistle.com>
next in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?Pine.BSF.4.05.9901280335450.304-100000>