All of lore.kernel.org
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Paolo Bonzini <pbonzini@redhat.com>
Cc: "Philippe Mathieu-Daudé" <f4bug@amsat.org>,
	"Krzysztof Kozlowski" <krzk@kernel.org>,
	"Igor Mitsyanko" <i.mitsyanko@gmail.com>,
	qemu-arm <qemu-arm@nongnu.org>,
	"QEMU Developers" <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [Qemu-arm] [PATCH 3/3] hw/misc/exynos4210_pmu: Reorder local variables for readability
Date: Mon, 6 Mar 2017 13:16:15 +0000	[thread overview]
Message-ID: <CAFEAcA-6yQ=95hGdia6TDhq4C-swOJ1iZA8C+u99Dy9kfG+f0w@mail.gmail.com> (raw)
In-Reply-To: <4989d5b6-586a-de18-e8e6-6ab9e9ac131c@redhat.com>

On 6 March 2017 at 13:03, Paolo Bonzini <pbonzini@redhat.com> wrote:
>
>
> On 06/03/2017 10:46, Peter Maydell wrote:
>> On 6 March 2017 at 04:06, Philippe Mathieu-Daudé <f4bug@amsat.org> wrote:
>>> your change seems OK but while you are here, 'unsigned' is considered
>>> harmful since more than a decade.
>>
>> Considered harmful by who, and why?
>
> It is true that unsigned has all the disadvantages of "int" (it may be
> smaller than the size of the object" and all the disadvantages of
> "size_t" (it doesn't optimize as well because the compiler cannot
> exploit undefined behavior).
>
> I wouldn't call it harmful, but it feels like the worst of both worlds.

size_t is a pretty silly choice for a variable that's looping
through the number of registers in the device, which is a value
that would fit in 16 bits, let alone 32. I would probably have
written this with 'int', but use of 'unsigned' doesn't come
very high up on my list of things to complain about.

(since we use -fwrapv the compiler can't exploit undefined
behaviour for signed loop indexes either.)

thanks
-- PMM

  reply	other threads:[~2017-03-06 13:16 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-05 21:48 [Qemu-devel] [PATCH 1/3] hw/arm/exynos: Convert fprintf to error_report() Krzysztof Kozlowski
2017-03-05 21:48 ` [Qemu-devel] [PATCH 2/3] hw/arm/exynos4210: Constify data pointed by few arguments and variables Krzysztof Kozlowski
2017-03-06  3:58   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-03-06  9:44   ` [Qemu-devel] " Peter Maydell
2017-03-06 17:14     ` Krzysztof Kozlowski
2017-03-05 21:48 ` [Qemu-devel] [PATCH 3/3] hw/misc/exynos4210_pmu: Reorder local variables for readability Krzysztof Kozlowski
2017-03-06  4:06   ` [Qemu-devel] [Qemu-arm] " Philippe Mathieu-Daudé
2017-03-06  9:46     ` Peter Maydell
2017-03-06 13:03       ` Paolo Bonzini
2017-03-06 13:16         ` Peter Maydell [this message]
2017-03-06 13:34           ` Philippe Mathieu-Daudé
2017-03-06 17:23     ` Krzysztof Kozlowski
2017-03-05 21:56 ` [Qemu-devel] [Qemu-arm] [PATCH 1/3] hw/arm/exynos: Convert fprintf to error_report() Philippe Mathieu-Daudé
2017-03-06 17:09   ` Krzysztof Kozlowski
2017-03-06 16:55 ` [Qemu-devel] " Eric Blake
2017-03-06 17:07   ` Krzysztof Kozlowski
2017-03-06 21:41     ` Peter Maydell

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='CAFEAcA-6yQ=95hGdia6TDhq4C-swOJ1iZA8C+u99Dy9kfG+f0w@mail.gmail.com' \
    --to=peter.maydell@linaro.org \
    --cc=f4bug@amsat.org \
    --cc=i.mitsyanko@gmail.com \
    --cc=krzk@kernel.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-arm@nongnu.org \
    --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.