Subject: Re: [PATCH 3/7] POWERPC: Move generic cpm2 stuff to powerpc

From: Benjamin Herrenschmidt <[email-masked]>
Date: Sun, 17 Sep 2006 08:55:51 +1000

On Sat, 2006-09-16 at 12:09 -0400, Dan Malek wrote:
> On Sep 16, 2006, at 4:36 AM, Stephen Rothwell wrote:
> 
> >
> >> +	if (brg < 4) {
> >> +		bp = (uint *)&cpm2_immr->im_brgc1;
> >> +	}
> >> +	else {
> >
> > Normally:
> > 	if (brg < 4)
> > 		bp = (uint *)&cpm2_immr->im_brgc1;
> > 	else {
> 
> Sorry, I'm going to nit-pick right back.  This isn't
> "normal", it's just your preference.  :-)

Nothing is "normal" in C coding style, it's all a matter of preference.
Not having braces around a single-line statement is indeed a preference
shared by the majority of the kernel maintainers, and thus becomes
de-facto the rule, which we can then qualify as "normal" in the context
of the linux kernel :)

> When the "else" part contains braces, the "if"
> part should as well.  If this get modified and
> nested some day in the future, this can cause
> a very subtle coding error.
> 
> No one should ever be criticized for using too
> many braces, provided it is artistically pleasing.
> 
> "Normally," the if-else without braces is only
> used when there are single statements on
> both paths of the logic.  The only exception
> is the else-if that emulates a case statement
> (when other exceptions also apply, see K&R).
> 
> Thanks.
> 
> 	-- Dan
> 
> _______________________________________________
> Linuxppc-dev mailing list
> [email-masked]
> https://ozlabs.org/mailman/listinfo/linuxppc-dev