From owner-freebsd-current Wed May 29 13:54: 9 2002 Delivered-To: freebsd-current@freebsd.org Received: from apollo.backplane.com (apollo.backplane.com [216.240.41.2]) by hub.freebsd.org (Postfix) with ESMTP id 6364A37B405; Wed, 29 May 2002 13:54:02 -0700 (PDT) Received: from apollo.backplane.com (localhost [127.0.0.1]) by apollo.backplane.com (8.12.3/8.12.3) with ESMTP id g4TKrj4j063139; Wed, 29 May 2002 13:54:00 -0700 (PDT) (envelope-from dillon@apollo.backplane.com) Received: (from dillon@localhost) by apollo.backplane.com (8.12.3/8.12.3/Submit) id g4TKrjqh063138; Wed, 29 May 2002 13:53:45 -0700 (PDT) (envelope-from dillon) Date: Wed, 29 May 2002 13:53:45 -0700 (PDT) From: Matthew Dillon Message-Id: <200205292053.g4TKrjqh063138@apollo.backplane.com> To: Julian Elischer Cc: "David O'Brien" , John Baldwin , FreeBSD current users Subject: Re: Seeking OK to commit KSE MIII References: Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG :having said that, :In this case the braces in question in ithread_schedule are: :- } else :+ } else { : curthread->td_kse->ke_flags |= KEF_NEEDRESCHED; :+ } : :I tend to always put braces on the else clause if the 'then' clause :has braces.. it just helps me find the end of the if statement. :The "if" statement in question was rewritten as part of KSE :so Adding the braces on the else clause doesn't seem 'out of scope' :to me.. It's not a tremendous obfuscation, because the clause :in question needs to be considered to understand the change.. I do this too. My rule for if() statements 'if (exp) stmt1 else stmt2' in the FreeBSD codebase is: * If or is multi-line, or is multi-line, then braces are used around both statements, period. Multi-line means: multiple lines inclusive of any comments, not just the pure C part of it. This is wrong: if (fubar) /* * yada yada */ stmt; else { stmt; stmt; } if (fubar) stmt; else { stmt; stmt; } This is right: if (fubar) { /* * yada yada */ stmt; } else { stmt; stmt; } if (fubar) { stmt; } else { stmt; stmt; } Same goes with for(), while(), etc. -Matt Matthew Dillon To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message