|
From: | Anthony Liguori |
Subject: | [Qemu-devel] Re: [PATCH] Make strtosz() return int64_t instead of ssize_t |
Date: | Wed, 05 Jan 2011 12:29:53 -0600 |
User-agent: | Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.1.15) Gecko/20101027 Lightning/1.0b1 Thunderbird/3.0.10 |
On 01/05/2011 08:40 AM, Jes Sorensen wrote:
On 01/05/11 14:46, Anthony Liguori wrote:On 01/05/2011 04:41 AM, address@hidden wrote:From: Jes Sorensen<address@hidden> strtosz() needs to return a 64 bit type even on 32 bit architectures. Otherwise qemu-img will fail to create disk images>= 2GB Signed-off-by: Jes Sorensen<address@hidden>off_t would be the proper type to use.I discussed this with Markus, and we both agree that it isn't. Two reasons, off_t is for filesystem offsets, not random sizes. Second, off_t doesn't have an unsigned type or a max to compare against.
That's because the size of off_t depends on whether it's a 32 or 64-bit platform and what FILESIZEBITS is defined to be.
Basically, if you're looking for the type to represent offsets in a file, it's off_t. That's why it exists.
That said, using this to represent memory too, I can buy that as a justification to use int64_t.
Using int64_t is cleaner and safer.
I wouldn't make such bold claims but I'll concede that one is not significantly better than the other and won't object to int64_t if you feel strongly.
Regards, Anthony Liguori
Cheers, Jes
[Prev in Thread] | Current Thread | [Next in Thread] |