mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: David Weinehall <tao@acc.umu.se>
To: Andries Brouwer <aebr@win.tue.nl>
Cc: Matt Mackall <mpm@selenic.com>, Andrew Morton <akpm@osdl.org>,
	Linus Torvalds <torvalds@osdl.org>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: Lindent fixed to match reality
Date: Thu, 29 Jan 2004 23:54:56 +0100	[thread overview]
Message-ID: <20040129225456.GM16675@khan.acc.umu.se> (raw)
In-Reply-To: <20040129233730.A19497@pclin040.win.tue.nl>

On Thu, Jan 29, 2004 at 11:37:30PM +0100, Andries Brouwer wrote:
> On Thu, Jan 29, 2004 at 09:15:56PM +0100, David Weinehall wrote:
> 
> > > b) (no -bs) "sizeof(foo)" rather than "sizeof (foo)"
> > 
> > I can't really see the logic in this, though I know a lot of people do
> > it.  I try to stay consistent, thus I do:
> > 
> > if ()
> > for ()
> > case ()
> > while ()
> > sizeof ()
> > typeof ()
> > 
> > since they're all parts of the language, rather than
> > functions/macros or invocations of such.
> 
> As you say, this is religion. Secondly, there need not be any logic.
> But thirdly, if you insist: The first four are about flow of control.
> We all agree they have spaces - it is Linux kernel standard.
> 
> On the other hand, sizeof is an arithmetical expression, often part
> of larger expressions. Now expressions like
> 	sizeof (*foo)+1
> might be confusing, and
> 	sizeof(*foo) + 1
> shows more clearly what the parsing is.

You should at least compare apples to apples, that is:

sizeof (*foo) + 1

vs

sizeof(*foo) + 1

But I guess that was just a typo?  Of course, since the ()'s are useless
here anyway, and doesn't really bring any added bonus, we end up with

sizeof *foo + 1

vs

sizeof*foo + 1

and I'd say the latter looks rather confusing, if not for anything else
because

sizeoffoo

would be invalid code, while

sizeof foo

is perfectly valid.

This is the same as

return *foo;

vs

return*foo;

I personally regard the former to be preferable, but it's it's a
preference, not a something I'd die over.


Regards: David
-- 
 /) David Weinehall <tao@acc.umu.se> /) Northern lights wander      (\
//  Maintainer of the v2.0 kernel   //  Dance across the winter sky //
\)  http://www.acc.umu.se/~tao/    (/   Full colour fire           (/

  reply	other threads:[~2004-01-29 22:55 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-01-29 19:37 Matt Mackall
2004-01-29 19:44 ` Linus Torvalds
2004-01-29 20:00   ` Matt Mackall
2004-01-29 20:15 ` David Weinehall
2004-01-29 20:35   ` Måns Rullgård
2004-01-29 20:42     ` David Weinehall
2004-01-29 20:52       ` Måns Rullgård
2004-01-29 21:46   ` Matt Mackall
2004-01-29 22:37   ` Andries Brouwer
2004-01-29 22:54     ` David Weinehall [this message]
2004-01-29 23:17       ` Tim Hockin
2004-01-29 23:43         ` David Weinehall
2004-01-30 14:44           ` Theodore Ts'o
2004-01-30 17:49             ` David Weinehall
2004-01-30 21:08   ` Eric W. Biederman
2004-01-29 20:17 ` Roland Dreier
2004-01-29 20:37 ` Erik Hensema
2004-01-29 21:55   ` Krzysztof Halasa
2004-01-30 16:36     ` Linus Torvalds
2004-01-30 10:38   ` Jan-Benedict Glaw

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=20040129225456.GM16675@khan.acc.umu.se \
    --to=tao@acc.umu.se \
    --cc=aebr@win.tue.nl \
    --cc=akpm@osdl.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mpm@selenic.com \
    --cc=torvalds@osdl.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

all inboxes | Powered by JetHome®