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: Richard W.M. Jones
Subject: Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants
Date: Fri, 14 Mar 2014 15:57:42 +0000
User-agent: Mutt/1.5.20 (2009-12-10)

On Fri, Mar 14, 2014 at 03:38:55PM +0000, Peter Maydell wrote:
> On 14 March 2014 15:36, Richard W.M. Jones <address@hidden> wrote:
> > On Fri, Mar 14, 2014 at 06:50:37AM -0400, Jeff Cody wrote:
> >> On 32-bit hosts, some compilers will warn on too large integer constants
> >> for constants that are 64-bit in length.  Explicitly put a 'ULL' suffix
> >> on those defines.
> >> -#define VHDX_FILE_SIGNATURE 0x656C696678646876  /* "vhdxfile" in ASCII */
> >> +#define VHDX_FILE_SIGNATURE 0x656C696678646876ULL  /* "vhdxfile" in ASCII 
> >> */
> >
> > I think it's better to use this C99-defined feature (from <stdint.h>):
> >
> > #define VHDX_FILE_SIGNATURE UINT64_C(0x656C696678646876)
> 
> Why? It's longer and we barely use it anywhere else
> in the codebase, whereas we use the ULL suffix all
> over the place...

It's permitted for unsigned long long to be longer than 64 bits.  The
UINT64_C() macro will always return a 64 bit int constant.  Yup, it's
not likely and for this particular macro it wouldn't matter.  (And I'm
not going to get into language-lawyering ...)

Rich.

-- 
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-top is 'top' for virtual machines.  Tiny program with many
powerful monitoring features, net stats, disk stats, logging, etc.
http://people.redhat.com/~rjones/virt-top



reply via email to

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