All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pavel Machek <pavel@suse.cz>
To: Dmitry Torokhov <dtor@insightbb.com>
Cc: Jan Engelhardt <jengelh@linux01.gwdg.de>,
	Nick Piggin <nickpiggin@yahoo.com.au>,
	Andrew Morton <akpm@osdl.org>,
	Christoph Hellwig <hch@infradead.org>,
	Richard Knutsson <ricknu-0@student.ltu.se>,
	James.Bottomley@steeleye.com, linux-scsi@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: Re: Conversion to generic boolean
Date: Sun, 3 Sep 2006 12:51:11 +0000	[thread overview]
Message-ID: <20060903125111.GG4884@ucw.cz> (raw)
In-Reply-To: <200608302350.17150.dtor@insightbb.com>

Hi!

> > I like it for the annotation we get.
> > 
> > 	int fluff;
> > 	if(fluff == 0)
> > 
> > This does not tell if fluff is an integer or a boolean (that is, what the
> > programmer intended to do -- not the 'int' the compiler sees).
> > If it had been if(!fluff), it would give a hint, but a lot of places also have
> > !x where x really is intended to be an integer (and should have been x==0 or
> > y==NULL resp.)
> >
> 
> Bool would not help much either unless declaration is immediately follows
> use. I like Alan Sterns proposal ofencode return value in function name
> better - actions should always return < 0/0 and predicates should always
> be boolean equivalent.

Sounds very reasonable. Even today, 90% of code follows that
convention. Perhaps adding it to codingstyle would help?

-- 
Thanks for all the (sleeping) penguins.

-- 
VGER BF report: H 0.254977

  reply	other threads:[~2006-09-04 12:33 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-26  3:24 Conversion to generic boolean Richard Knutsson
2006-08-28  9:32 ` Christoph Hellwig
2006-08-28  9:45   ` Jesper Juhl
2006-08-29 11:39     ` Christoph Hellwig
2006-08-28 10:58   ` Jan Engelhardt
2006-08-28 11:11     ` Bernd Petrovitsch
2006-08-28 12:17     ` Richard Knutsson
2006-08-28 19:15       ` Nicholas Miell
2006-08-28 20:55         ` Richard Knutsson
2006-08-28 21:19           ` Nicholas Miell
2006-08-28 21:55             ` Richard Knutsson
2006-08-29 11:41         ` Christoph Hellwig
2006-08-29 12:17           ` Jan Engelhardt
2006-08-29 13:26             ` Peter Williams
2006-08-29 13:56               ` Jan Engelhardt
2006-08-29 12:48           ` Alan Cox
2006-08-29  0:18   ` Andrew Morton
2006-08-29  1:15     ` Nick Piggin
2006-08-29  5:58       ` Jan Engelhardt
2006-08-31  3:50         ` Dmitry Torokhov
2006-09-03 12:51           ` Pavel Machek [this message]
2006-08-29  7:29       ` Anton Altaparmakov
2006-08-29 11:46         ` Christoph Hellwig
2006-08-29 12:18           ` Anton Altaparmakov
2006-08-29 11:45     ` Christoph Hellwig
2006-08-29 14:10       ` Richard Knutsson
2006-08-29 15:47       ` Andrew Morton
  -- strict thread matches above, loose matches on Subject: below --
2006-08-29  5:43 linux

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=20060903125111.GG4884@ucw.cz \
    --to=pavel@suse.cz \
    --cc=James.Bottomley@steeleye.com \
    --cc=akpm@osdl.org \
    --cc=dtor@insightbb.com \
    --cc=hch@infradead.org \
    --cc=jengelh@linux01.gwdg.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    --cc=nickpiggin@yahoo.com.au \
    --cc=ricknu-0@student.ltu.se \
    /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.