From: Peter Williams <peterw@aurema.com>
To: Chip Salzenberg <chip@pobox.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: (0 == foo), rather than (foo == 0)
Date: Fri, 12 Mar 2004 10:57:45 +1100 [thread overview]
Message-ID: <4050FCF9.6070800@aurema.com> (raw)
In-Reply-To: <E1B1TIJ-0007Tm-Jn@tytlal>
Chip Salzenberg wrote:
> Amarendra.Godbole@ge.com writes:
>
>>>As a result, using the former just tends to increase peoples
>>>confusion by making code harder to read, which in turn tends
>>>to increase the chance of bugs.
>>
>>Kindly don't insult the kernel developers' with such statements. ;-)
>>They are smart enough to understand such constructs [...]
>
>
> It's not about intelligence! It's about the nature of human visual
> pattern-matching. Reading a pattern is always easier when you've seen
> it thousands of times before.
>
> Henry Spencer's dictum about brace style seems particularly apropos:
>
> 8. Thou shalt make thy program's purpose and structure clear to thy
> fellow man by using the One True Brace Style, even if thou likest
> it not, for thy creativity is better used in solving problems than
> in creating beautiful new impediments to understanding.
>
> And that's what "0 == foo" is: an impediment to understanding.
It's got nothing to do with visual scanning. It's more to do with
grammatical form i.e. we (especially English speakers) like the form:
subject (foo) verb (==) object (0); and in these cases the variable
(foo) is the indisputable subject (i.e. the thing the sentence is about)
but (0 == foo) momentarily causes us to think that 0 is the subject and
we find this disconcerting. On the other hand, Yoda (the Jedi master)
would probably prefer: (0 foo ==) :-)
Like most matters of style there are points for and against both methods
and eventually someone has to make a (relatively arbitrary) decision.
Linus has made the decision and it's his call so we should abide by it
(especially since he made it pretty clear that he was aware of (and
considered) all the relevant arguments and is therefore unlikely to
change his mind).
Peter
PS It's important not to get too emotionally attached to a particular
method or style because there's always a chance that whoever gets to
decide which will be used may not choose the one you like. This time
you lucked in :-)
--
Dr Peter Williams, Chief Scientist peterw@aurema.com
Aurema Pty Limited Tel:+61 2 9698 2322
PO Box 305, Strawberry Hills NSW 2012, Australia Fax:+61 2 9699 9174
79 Myrtle Street, Chippendale NSW 2008, Australia http://www.aurema.com
next prev parent reply other threads:[~2004-03-11 23:59 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <1ypPV-5N2-3@gated-at.bofh.it>
2004-03-11 16:44 ` (0 == foo), rather than (foo == 0) Chip Salzenberg
2004-03-11 23:57 ` Peter Williams [this message]
2004-03-12 1:51 ` Chris Johns
2004-03-12 12:21 ` Richard B. Johnson
[not found] <1y5oc-8cr-1@gated-at.bofh.it>
[not found] ` <1ygjH-3LE-31@gated-at.bofh.it>
[not found] ` <1ygMH-4eu-21@gated-at.bofh.it>
[not found] ` <1yzZ9-1qq-43@gated-at.bofh.it>
[not found] ` <1yAs0-1P6-7@gated-at.bofh.it>
[not found] ` <1yALu-288-5@gated-at.bofh.it>
2004-03-11 16:41 ` Chip Salzenberg
2004-03-11 4:04 Godbole, Amarendra (GE Consumer & Industrial)
-- strict thread matches above, loose matches on Subject: below --
2004-03-10 6:16 Godbole, Amarendra (GE Consumer & Industrial)
2004-03-10 10:34 ` Bernd Petrovitsch
2004-03-10 18:02 ` Randy.Dunlap
2004-03-10 18:33 ` Richard B. Johnson
2004-03-10 23:00 ` Peter Williams
2004-03-11 0:16 ` Randy.Dunlap
2004-03-11 2:36 ` Linus Torvalds
2004-03-11 3:08 ` Peter Williams
2004-03-11 3:19 ` Linus Torvalds
2004-03-11 4:40 ` Stefan Smietanowski
2004-03-11 9:48 ` Måns Rullgård
2004-03-11 10:29 ` Stefan Smietanowski
2004-03-11 15:18 ` Andreas Schwab
2004-03-11 17:42 ` Stefan Smietanowski
2004-03-11 23:05 ` Bill Davidsen
2004-03-11 6:50 ` Willy Tarreau
2004-03-11 7:36 ` Peter Williams
2004-03-11 15:03 ` Valdis.Kletnieks
2004-03-11 15:22 ` Richard B. Johnson
2004-03-11 15:48 ` Valdis.Kletnieks
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=4050FCF9.6070800@aurema.com \
--to=peterw@aurema.com \
--cc=chip@pobox.com \
--cc=linux-kernel@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