[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] Hacks for building on gcc 7 / Fedora 26
From: |
Eric Blake |
Subject: |
Re: [Qemu-devel] Hacks for building on gcc 7 / Fedora 26 |
Date: |
Thu, 20 Jul 2017 13:36:40 -0500 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 |
On 07/20/2017 12:06 PM, Daniel P. Berrange wrote:
>>> IMHO your patch is ok, or we could be alittle more explicit about
>>> catching just the case where you pass -1 for bytes, and have
>>>
>>> && bytes != -1
>>
>> This seems bizarre to me since bytes is size_t bytes and size_t
>> is unsigned, so I'd have sympathy for a compiler that warned that
>> bytes != -1 was always true.
>
> Could be paranoid and do "&& bytes != (size_t)-1"
Any compiler that treats 'bytes != -1' differently from 'bytes !=
(size_t)-1' is broken, since those two are equivalent per C99 promotion
rules (unsigned op signed produces unsigned, and conversion of signed to
unsigned is well-defined). I prefer the form without a cast.
--
Eric Blake, Principal Software Engineer
Red Hat, Inc. +1-919-301-3266
Virtualization: qemu.org | libvirt.org
signature.asc
Description: OpenPGP digital signature
Re: [Qemu-devel] Hacks for building on gcc 7 / Fedora 26, Daniel P. Berrange, 2017/07/20