From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38783) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOUUf-0002DV-UX for qemu-devel@nongnu.org; Fri, 14 Mar 2014 11:58:03 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WOUUZ-0001tz-VT for qemu-devel@nongnu.org; Fri, 14 Mar 2014 11:57:57 -0400 Received: from mx1.redhat.com ([209.132.183.28]:36323) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WOUUZ-0001tt-M9 for qemu-devel@nongnu.org; Fri, 14 Mar 2014 11:57:51 -0400 Date: Fri, 14 Mar 2014 15:57:42 +0000 From: "Richard W.M. Jones" Message-ID: <20140314155742.GU1346@redhat.com> References: <3096076082478dafe78553ab5cbd8b572904cbc4.1394794127.git.jcody@redhat.com> <20140314153639.GD1985@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Subject: Re: [Qemu-devel] [PATCH] block: Explicitly specify 'unsigned long long' for VHDX 64-bit constants List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Peter Maydell Cc: Kevin Wolf , Jeff Cody , QEMU Developers , Stefan Hajnoczi , Alexander Graf On Fri, Mar 14, 2014 at 03:38:55PM +0000, Peter Maydell wrote: > On 14 March 2014 15:36, Richard W.M. Jones 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 ): > > > > #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