public inbox for kernel-janitors@vger.kernel.org
 help / color / mirror / Atom feed
From: Bernd Petrovitsch <bernd@petrovitsch.priv.at>
To: kernel-janitors@vger.kernel.org
Subject: Re: [patch] oxygen: clean up. make precedence explicit
Date: Fri, 19 Feb 2010 13:09:11 +0000	[thread overview]
Message-ID: <1266584951.31443.15.camel@thorin> (raw)
In-Reply-To: <4B7E4BD1.3040106@ladisch.de>

On Fre, 2010-02-19 at 14:29 +0300, Dan Carpenter wrote:
> On Fri, Feb 19, 2010 at 11:33:30AM +0100, Bernd Petrovitsch wrote:
[...]
> Basically often when people write:
> 	if (!foo = bar) { ...
> 
> What they mean is:
> 	if (!(foo = bar)) { ...
Ugh. The IMHO better way is 
	if (foo != bar) { ...
Or do we need
#define unless(cond) if (!(cond))
(as in perl)?

> But if they really do mean the original code they could just write 
> this so it's clear to everyone: 
> 	if ((!foo) = bar) { ...
Well, since we have a boolean/0-or-1 on the left side, there actually
shouldn't be too much cases to compare in that way to another value.

> To me it's like "=" vs "=".  Of course, every programmer knows the 
> what the difference is but it helps to have gcc warn about adding the 
> extra parenthesis.  Maybe I suck, but it definitely has helped me in 
> then past.
At most your coding style sucks. We have all our syntax quirks ....
IMHO it is extremely uncommon style (which adds to "doesn't buy that
much" for me).

> I don't have strong feelings about this btw.  The original code in
> oxygyn_mixer works fine.  I just was making some changes to smatch and
> that was a new warning today.  There is no method to my madness.
If there is method to madness, would it actually be madness? ;-)

	Bernd
-- 
Bernd Petrovitsch                  Email : bernd@petrovitsch.priv.at
                     LUGA : http://www.luga.at


  parent reply	other threads:[~2010-02-19 13:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-19  8:29 [patch] oxygen: clean up. make precedence explicit Clemens Ladisch
2010-02-19 10:10 ` Dan Carpenter
2010-02-19 10:33 ` Bernd Petrovitsch
2010-02-19 11:29   ` Dan Carpenter
2010-02-19 16:58     ` Dan Carpenter
2010-02-19 13:09 ` Bernd Petrovitsch [this message]
2010-02-19 17:24   ` Clemens Ladisch
2010-02-19 20:08     ` Dan Carpenter
  -- strict thread matches above, loose matches on Subject: below --
2010-02-19  6:58 Dan Carpenter

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=1266584951.31443.15.camel@thorin \
    --to=bernd@petrovitsch.priv.at \
    --cc=kernel-janitors@vger.kernel.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox