All of lore.kernel.org
 help / color / mirror / Atom feed
From: Al Viro <viro@ftp.linux.org.uk>
To: ricknu-0@student.ltu.se
Cc: linux-sparse@vger.kernel.org
Subject: Re: Booleans, what a wonderful type!
Date: Wed, 18 Jul 2007 03:25:19 +0100	[thread overview]
Message-ID: <20070718022519.GT21668@ftp.linux.org.uk> (raw)
In-Reply-To: <1184723019.469d704b6111b@portal.student.luth.se>

On Wed, Jul 18, 2007 at 03:43:39AM +0200, ricknu-0@student.ltu.se wrote:
> Good morning to you all!
> 
> As most of you do not know, I am on Google's SoC
> <http://code.google.com/soc/2007/sparse/appinfo.html?csaid=CB0974F67B64AD0C> to
> add the ability to suggestions when booleans could/should be used.

Er...  Of _course_ booleans are values.  And yes, you can say true + false.
Guaranteed to evaluate to int, value of expression being 1.  It's perfectly
correct C99.  Same as true + true is guaranteed to be 2 (int, again); assigning
that to _Bool variable is guaranteed to give 1, aka true (see the rules
for conversion to _Bool).

Now, sparse handling of _Bool sucks in quite a few places (e.g. conversion
to it is not reduction modulo 2, it's comparison with 0), but I wonder if
that's what you have in mind...

  parent reply	other threads:[~2007-07-18  2:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-07-18  1:43 Booleans, what a wonderful type! ricknu-0
2007-07-18  2:19 ` Al Viro
2007-07-18  2:40   ` Brett Nash
2007-07-18 16:33   ` Josh Triplett
2007-07-19  0:23     ` ricknu-0
2007-07-18  2:25 ` Al Viro [this message]
2007-07-19  0:38   ` ricknu-0
2007-07-19  7:30     ` Al Viro

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=20070718022519.GT21668@ftp.linux.org.uk \
    --to=viro@ftp.linux.org.uk \
    --cc=linux-sparse@vger.kernel.org \
    --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.