All of lore.kernel.org
 help / color / mirror / Atom feed
From: Avi Kivity <avi@redhat.com>
To: Jes Sorensen <Jes.Sorensen@redhat.com>
Cc: Blue Swirl <blauwirbel@gmail.com>,
	qemu-devel <qemu-devel@nongnu.org>,
	Richard Henderson <rth@twiddle.net>
Subject: Re: [Qemu-devel] [PATCH 2/5] CODING_STYLE: add C type rules
Date: Thu, 19 Aug 2010 15:24:52 +0300	[thread overview]
Message-ID: <4C6D2294.60304@redhat.com> (raw)
In-Reply-To: <4C6CE88C.9050100@redhat.com>

  On 08/19/2010 11:17 AM, Jes Sorensen wrote:
> On 08/19/10 10:10, Avi Kivity wrote:
>>   On 08/19/2010 10:58 AM, Jes Sorensen wrote:
>>>> In C99, bool is a real type.
>>> Kinda real, I would qualify it more as a pseudo type. It doesn't map to
>>> any register size or even instruction actions.
>> Neither do int, short, long, long long, or signed short long float.
> Well most processors support 32 bit register ops, even when running in
> 64 bit mode.

8-bit processors have 8-bit register size and 16-bit ints.  Some 
processors have 36-bit ints.  If you only code for processors which have 
Linux ports, and for those ports, then everything will be the same.  
Surprise!

> long is the maximum register size in pretty much any sane
> setup,

Not on those 8-bit machines.

> which is why it is such a mess that M$ took the easy way out when
> they picked for win64. Tons of user code will have portability problems
> because of this.

They did that to avoid portability problems, presumably.

>>> Most processors, at least
>>> the ones I have programmed, tend to treat it as zero == false,
>>> everything else == true.
>> Processors don't have _Bool.
> No but something has to generate code to handle it.

gcc

>>> For structure packing it's ugly.
>> Use uint*_t for externally visible structures.  use _Bool for internal
>> booleans.
> Structure packing is more than passing structures to external processes
> or saving them, it's also cache line alignment. In your case we should
> change pretty much any data structure in QEMU that is in a critical data
> path to use *int*_t.

Not at all, _Bool is smaller or equal to int and thus can only improve 
packing.

If you want to align explicitly, use alignment attributes.

-- 
error compiling committee.c: too many arguments to function

  reply	other threads:[~2010-08-19 12:24 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 [this message]
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
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=4C6D2294.60304@redhat.com \
    --to=avi@redhat.com \
    --cc=Jes.Sorensen@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    /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.