Date: Wed, 29 May 2002 13:53:45 -0700 (PDT) From: Matthew Dillon <dillon@apollo.backplane.com> To: Julian Elischer <julian@elischer.org> Cc: "David O'Brien" <obrien@FreeBSD.ORG>, John Baldwin <jhb@FreeBSD.ORG>, FreeBSD current users <current@FreeBSD.ORG> Subject: Re: Seeking OK to commit KSE MIII Message-ID: <200205292053.g4TKrjqh063138@apollo.backplane.com> References: <Pine.BSF.4.21.0205291313220.12315-100000@InterJet.elischer.org>
next in thread | previous in thread | raw e-mail | index | archive | help
: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 <stmt1> or <stmt2> is multi-line, or <exp> 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
<dillon@backplane.com>
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?200205292053.g4TKrjqh063138>
