From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55479) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHDn8-0006KT-9M for qemu-devel@nongnu.org; Thu, 07 Jan 2016 11:52:03 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1aHDn5-0000Vo-Jj for qemu-devel@nongnu.org; Thu, 07 Jan 2016 11:52:02 -0500 Received: from mx1.redhat.com ([209.132.183.28]:57317) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1aHDn5-0000Vk-EP for qemu-devel@nongnu.org; Thu, 07 Jan 2016 11:51:59 -0500 References: <1452047951-17429-1-git-send-email-caoj.fnst@cn.fujitsu.com> <1452047951-17429-4-git-send-email-caoj.fnst@cn.fujitsu.com> <568D3AB2.8020100@redhat.com> <568E1DD9.7020502@cn.fujitsu.com> From: Eric Blake Message-ID: <568E97AD.4000701@redhat.com> Date: Thu, 7 Jan 2016 09:51:57 -0700 MIME-Version: 1.0 In-Reply-To: <568E1DD9.7020502@cn.fujitsu.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="Sh5XmF79mHwfhVkIMDvcl0rip18oh8ii8" Subject: Re: [Qemu-devel] [PATCH v3 3/4] Add Error **errp for xen_pt_config_init() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Cao jin , qemu-devel@nongnu.org Cc: stefano.stabellini@eu.citrix.com This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --Sh5XmF79mHwfhVkIMDvcl0rip18oh8ii8 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 01/07/2016 01:12 AM, Cao jin wrote: >>> if (rc < 0) { >>> - XEN_PT_LOG(&s->dev, "Failed to initialize %d/%ld, >>> type=3D0x%x, rc:%d\n", >>> - i, ARRAY_SIZE(xen_pt_emu_reg_grps), >>> + error_setg(&local_err, "Failed to initialize %d/%ld,= >>> type=3D0x%x," >>> + " rc:%d", i, >>> ARRAY_SIZE(xen_pt_emu_reg_grps), >> >> This maps ARRAY_SIZE() (which is size_t) to %ld, which can fail to >> compile on 32-bit platforms (where size_t is not necessarily long). F= ix >> it to %zd while touching it. >> >=20 > a question: > 1. Is %zu more suitable for size_t? since size_t is unsigned integer. Yes, you're right on that one. >=20 > and a personal question after digging into size_t: > 2. Does the size of size_t always equal to the word length[*] of comput= er No. It equals the maximum size the program can use. But the x32 ABI project is a good example of a 32-bit size_t while still taking full advantage of the 64-bit word size registers, in the name of memory efficiencies. See https://en.wikipedia.org/wiki/X32_ABI. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --Sh5XmF79mHwfhVkIMDvcl0rip18oh8ii8 Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJWjpetAAoJEKeha0olJ0Nq2TIH/R1W32Y4/uYboWfDRq4VoQ3Z eutBOud4j6mQUrsFhc883RIjyZsz/e08/mPFh6tZVgpC2fompvuWB2AMEuZy4cb3 CKF/EonZv0TLRCSzhKH4J3IHLIvoPX9boRAVvBDgHRCYQXKa5KgR8T81T75rptTL 6piXmLCr/rm+EnmjboflWvq3eXDmso3c7QgweZE2vIWdtAeQfbNCNZYQYthZNJeY faHWT/DeoUZTMPdAe8/VSpnnL/w+8ixdRKHMji+xdL32skahJB81KkA9fpvc1Dzo QmrDuAno0VOrvuQUSeztSnozR91AADs8eAFX6wuPtJvwhgkh/Wp2ClrBCAc4S4c= =Aeic -----END PGP SIGNATURE----- --Sh5XmF79mHwfhVkIMDvcl0rip18oh8ii8--