qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long'


From: Laszlo Ersek
Subject: Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants
Date: Fri, 14 Mar 2014 19:16:46 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:24.0) Gecko/20100101 Thunderbird/24.3.0

On 03/14/14 18:49, Richard W.M. Jones wrote:
> On Fri, Mar 14, 2014 at 06:27:07PM +0100, Laszlo Ersek wrote:
>> *Why* someone would want to use an integer constant with type
>> "uint_least64_t" is a separate matter. One example follows -- assume all
>> of the below:
>> - suppose you write portable C99 source code,
>> - hence you can't take uint64_t for granted,
>> - you want a constant that's otherwise small enough to be represented as
>> "int",
>> - but you want that constant to trigger the "usual arithmetic
>> conversions" (see 6.3.1.8) to evaluate expressions that the constant
>> participates in in at least 64 bits,
>> - you want the narrowest type that allows you to do this.
> 
> - You want the code to self-document its intentions.

I do.

> I don't think ULL does that because it requires people to know that
> ULL is at least 64 bits.

Oh. I see what you mean. This never crossed my mind (= people missing
the fact that unsigned long long can represent at least up to 2^64-1).

Laszlo




reply via email to

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