Re: [Qemu-devel] [PATCH v4] build: Work around SIZE_MAX bug in OSX headers

2016-10-11 Thread Eric Blake
On 10/11/2016 02:18 AM, Markus Armbruster wrote: >> +#define SIZE_MAX ((sizeof(char)) * -1) > > All right, let's see how this works. > > > Cute, but what's wrong with straightforward > > #define SIZE_MAX ((size_t)-1) I was trying to make the macro usable even in situations where 'size_t'

Re: [Qemu-devel] [PATCH v4] build: Work around SIZE_MAX bug in OSX headers

2016-10-11 Thread Markus Armbruster
Eric Blake writes: > C99 requires SIZE_MAX to be declared with the same type as the > integral promotion of size_t, but OSX mistakenly defines it as > an 'unsigned long long' expression even though size_t is only > 'unsigned long'. Rather than futzing around with whether size_t > is 32- or 64-bi

[Qemu-devel] [PATCH v4] build: Work around SIZE_MAX bug in OSX headers

2016-10-10 Thread Eric Blake
C99 requires SIZE_MAX to be declared with the same type as the integral promotion of size_t, but OSX mistakenly defines it as an 'unsigned long long' expression even though size_t is only 'unsigned long'. Rather than futzing around with whether size_t is 32- or 64-bits wide (which would be needed