On 09/04/16 00:31, Richard Henderson wrote: > On 04/08/2016 02:26 PM, Paolo Bonzini wrote: >> >> On 08/04/2016 23:24, Alex Bennée wrote: >>>> Except that quite a lot of hosts can only (efficiently) do atomic >>>> operations on >>>> a minimum of 4 byte quantities. I'd rather continue to use int here. >>> I suspect bool == unsigned int underneath. But having true/false and 0/1 >>> mixed up >>> gets confusing even if they are equivalent. >> Sometimes sizeof(bool) == 1. > sizeof(bool) == 1 everywhere except MacOSX, where it's 4. >
Hm, that's too strange: $ gcc a.c a.c: In function ‘main’: a.c:6:5: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long unsigned int’ [-Wformat=] printf("%d\n", sizeof(bool)); ^ $ ./a.out 1 Kind regards, Sergey