All of lore.kernel.org
 help / color / mirror / Atom feed
From: Randy Dunlap <randy.dunlap@oracle.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: Scott Preece <sepreece@gmail.com>,
	kernel list <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH/v2] CodingStyle updates
Date: Fri, 15 Dec 2006 09:00:37 -0800	[thread overview]
Message-ID: <20061215090037.05c021af.randy.dunlap@oracle.com> (raw)
In-Reply-To: <20061215150717.GA2345@elf.ucw.cz>

On Fri, 15 Dec 2006 16:07:17 +0100 Pavel Machek wrote:

> On Fri 2006-12-15 08:52:22, Scott Preece wrote:
> > On 12/15/06, Pavel Machek <pavel@ucw.cz> wrote:
> > >Hi!
> > >
> > >> Pavel Machek wrote:
> > >> >> From: Randy Dunlap <randy.dunlap@oracle.com>
> > >> >> +Use one space around (on each side of) most binary and ternary 
> > >operators,
> > >> >> +such as any of these:
> > >> >> +  =  +  -  <  >  *  /  %  |  &  ^  <=  >=  ==  !=  ?  :
> > >> >
> > >> > Actually, this should not be hard rule. We want to allow
> > >> >
> > >> >     j = 3*i + l<<2;
> > >>
> > >> Which would be very misleading. This expression evaluates to
> > >>
> > >>       j = (((3 * i) + l) << 2);
> > >>
> > >> Binary + precedes <<.
> > >
> > >Aha, okay. So this one should be written as
> > >
> > >        j = 3*i+l << 2;
> > >
> > >(Well, parenthesses should really be used. Anyway, sometimes grouping
> > >around operator is useful, even if I made mistake demonstrating that.
> > ---
> > 
> > I think the mistake illuminates why parentheses should be the rule. If
> > you're thinking about using spacing to convey grouping, use
> > parentheses instead...
> 
> Not in simple cases.
> 
> 	3*i + 2*j should be writen like that. Not like
> 	(3 * i) + (2 * j)

I would just write it as:
	3 * i + 2 * j

---
~Randy

  parent reply	other threads:[~2006-12-15 16:59 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-12-08  0:55 [PATCH/v2] CodingStyle updates Randy Dunlap
2006-12-08 11:04 ` Jan Engelhardt
2006-12-15 12:09 ` Pavel Machek
2006-12-15 14:18   ` Stefan Richter
2006-12-15 14:22     ` Pavel Machek
2006-12-15 14:28       ` Stefan Richter
2006-12-15 17:06         ` Jan Engelhardt
2006-12-15 17:13         ` Randy Dunlap
2006-12-15 14:52       ` Scott Preece
2006-12-15 15:04         ` Stefan Richter
2006-12-15 15:07         ` Pavel Machek
2006-12-15 16:16           ` Scott Preece
2006-12-15 17:00           ` Randy Dunlap [this message]
2006-12-15 20:11             ` Jörn Engel
2006-12-15 20:26               ` Randy Dunlap
2006-12-15 21:10                 ` Jörn Engel
2006-12-15 21:16                   ` Jörn Engel
2006-12-15 21:25                     ` Randy Dunlap
2006-12-15 20:56               ` Dmitry Torokhov
2006-12-15 21:01                 ` Jan Engelhardt
2006-12-15 21:27                   ` Jörn Engel
2006-12-15 21:59                     ` Jan Engelhardt
2006-12-19 18:46                       ` 2.6.20-rc1-mm1 suspicious prececence code ( was " Valdis.Kletnieks
2006-12-15 20:30             ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20061215090037.05c021af.randy.dunlap@oracle.com \
    --to=randy.dunlap@oracle.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pavel@ucw.cz \
    --cc=sepreece@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.