Received: from eggs.gnu.org ([2001:4830:134:3::10]:51042) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bty1z-0008Us-Qe for qemu-devel@nongnu.org; Tue, 11 Oct 2016 10:27:48 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bty1y-0008J9-N8 for qemu-devel@nongnu.org; Tue, 11 Oct 2016 10:27:47 -0400 References: <1476138452-5244-1-git-send-email-eblake@redhat.com> <87lgxvqrot.fsf@dusky.pond.sub.org> From: Eric Blake Message-ID: Date: Tue, 11 Oct 2016 09:27:41 -0500 MIME-Version: 1.0 In-Reply-To: <87lgxvqrot.fsf@dusky.pond.sub.org> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="LiSOMtvc1DlXNC191TA2X4P1iLIFr1WEi" Subject: Re: [Qemu-devel] [PATCH v4] build: Work around SIZE_MAX bug in OSX headers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Markus Armbruster Cc: qemu-devel@nongnu.org, kwolf@redhat.com, peter.maydell@linaro.org, ashijeetacharya@gmail.com, qemu-block@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --LiSOMtvc1DlXNC191TA2X4P1iLIFr1WEi From: Eric Blake To: Markus Armbruster Cc: qemu-devel@nongnu.org, kwolf@redhat.com, peter.maydell@linaro.org, ashijeetacharya@gmail.com, qemu-block@nongnu.org Message-ID: Subject: Re: [Qemu-devel] [PATCH v4] build: Work around SIZE_MAX bug in OSX headers References: <1476138452-5244-1-git-send-email-eblake@redhat.com> <87lgxvqrot.fsf@dusky.pond.sub.org> In-Reply-To: <87lgxvqrot.fsf@dusky.pond.sub.org> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 10/11/2016 02:18 AM, Markus Armbruster wrote: >> +#define SIZE_MAX ((sizeof(char)) * -1) >=20 > All right, let's see how this works. >=20 >=20 > Cute, but what's wrong with straightforward >=20 > #define SIZE_MAX ((size_t)-1) I was trying to make the macro usable even in situations where 'size_t' itself is undefined (because sufficient headers were not pre-included). But you're right: pulls in , and therefore size_t is always available. And since neither my solution nor your shorter direct cast is usable in a preprocessor expression, neither has that advantage in its favor (a solution that works in ALL scenarios required by C99, at the expense of more text, would have an advantage). So I guess going with the shorter direct cast is just fine. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --LiSOMtvc1DlXNC191TA2X4P1iLIFr1WEi 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/ iQEcBAEBCAAGBQJX/PbdAAoJEKeha0olJ0Nq7H4H/jREvZy7EvxDgAqUyxOGCdcT Xm072iPZ46hRoac4ZE4kiPaoQYdguCiKKF7l21dUvBY0vmJzW2z25HPblOKhbMdW e5IjLwdgxKXpuJ1XJSut8/g2hLsF9fbY8KxtFSiljpgBwn8+i1YRuJguJxh9jCmw eIVatFLOOyRdisqcpniukWqInxOF0/yPKb7O23OBP0M0SrU3e9HQqVYk7ydTVoBR 4V6+H555KPAGOqpZ19pU+6K8Nkp2OTXOF9vrRMkXwaunlTIXFJ00ye44Zx01tZ/T SBgFGA2JrSz66GDM0V9QbSY3xnr7xxG9uvSkhxNzdIavV91nndl+sxBzdaXfJd0= =ABzH -----END PGP SIGNATURE----- --LiSOMtvc1DlXNC191TA2X4P1iLIFr1WEi--