All of lore.kernel.org
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Avi Kivity <avi@redhat.com>
Cc: Kevin Wolf <kwolf@redhat.com>, Blue Swirl <blauwirbel@gmail.com>,
	qemu-devel@nongnu.org, Jes Sorensen <Jes.Sorensen@redhat.com>
Subject: Re: [Qemu-devel] Re: [PATCH 2/5] CODING_STYLE: add C type rules
Date: Thu, 19 Aug 2010 09:51:46 +0200	[thread overview]
Message-ID: <4C6CE292.7090404@redhat.com> (raw)
In-Reply-To: <4C6C1072.1000200@redhat.com>

On 08/18/2010 06:55 PM, Avi Kivity wrote:
>> - Do not rely on the fact that bool normalizes logical non-false values
>> to 1. So, write "x = true" instead of "x++" and "x = !x" instead of
>> "x--".
>> - Similarly, when x is a bool, it may be clearer to avoid
>> "x |= y". Instead, use either "x = x || y" (if short circuiting
>> is acceptable or even desirable) or "x |= (y != 0)".
>>
>> Probably a bit too verbose, but you get the idea.
>
> _Bool can have values of 0 or 1, so all of the above should actually work.

Yes, I'd like to rule those out even though they work, because I find 
them confusing.  The compiler is smart enough to generate the same code 
in both cases.

Paolo

  reply	other threads:[~2010-08-19  7:51 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-12 17:50 [Qemu-devel] [PATCH 2/5] CODING_STYLE: add C type rules Blue Swirl
2010-08-13 19:37 ` [Qemu-devel] " Blue Swirl
2010-08-17  8:09 ` [Qemu-devel] " Jes Sorensen
2010-08-17 17:56   ` Blue Swirl
2010-08-17 18:55     ` malc
2010-08-17 19:23       ` Jes Sorensen
2010-08-17 19:24         ` malc
2010-08-17 19:43           ` Jes Sorensen
2010-08-17 20:29             ` Anthony Liguori
2010-08-17 20:33             ` malc
2010-08-17 18:39   ` Richard Henderson
2010-08-17 19:15     ` Jes Sorensen
2010-08-18 16:46       ` Avi Kivity
2010-08-19  7:58         ` Jes Sorensen
2010-08-19  8:10           ` Avi Kivity
2010-08-19  8:17             ` Jes Sorensen
2010-08-19 12:24               ` Avi Kivity
2010-08-19 12:52                 ` malc
2010-08-19 12:59                   ` Avi Kivity
2010-08-18  8:35     ` [Qemu-devel] " Paolo Bonzini
2010-08-18  8:58       ` Jes Sorensen
2010-08-18 10:30       ` Kevin Wolf
2010-08-18 13:57         ` Paolo Bonzini
2010-08-18 16:55           ` Avi Kivity
2010-08-19  7:51             ` Paolo Bonzini [this message]
2010-08-19  8:12               ` Avi Kivity
2010-08-18 16:44   ` [Qemu-devel] " Avi Kivity

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=4C6CE292.7090404@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=Jes.Sorensen@redhat.com \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=kwolf@redhat.com \
    --cc=qemu-devel@nongnu.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 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.