qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH] qga/commands-posix.c: Use correct types with g_


From: Eric Blake
Subject: Re: [Qemu-devel] [PATCH] qga/commands-posix.c: Use correct types with g_base64_decode()
Date: Tue, 14 Apr 2015 09:12:33 -0600
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0

On 04/14/2015 08:50 AM, Paolo Bonzini wrote:
> 
> 
> On 14/04/2015 16:35, Eric Blake wrote:
>> On 04/14/2015 08:29 AM, Paolo Bonzini wrote:
>>> But you can: gsize is defined to be "An unsigned integer type of
>>> the result of the sizeof operator, corresponding to the size_t
>>> type defined in C99.
>>
>> Good so far.
>>
>>> This type is wide enough to hold the numeric value of a pointer,
>>
>> Not true on platforms where size_t is 32 bits but pointers are 64
>> bits.
> 
> Are there any?  I don't think QEMU supports them anyway.

Hmm. I looked, but mingw64 (32-bit long, 64-bit size_t and pointers) and
x32 ABI on x86_64 (32-bit size_t, but also 32-bit pointers) are both
safe, and I couldn't think of any other common platforms likely to be an
oddball.  Still, the point remains that the glib statement is not
required to be true, and only happens to work on the common platforms it
is ported to, because it IS within the bounds of the standard to
restrict maximum object size to be less than the range of a pointer.

-- 
Eric Blake   eblake redhat com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]