Re: [Outreachy kernel] [RESEND PATCH 2/2] staging: vboxvideo: Use unsigned int instead bool
From: Julia Lawall
Date: Sun Oct 28 2018 - 04:47:46 EST
> The "possible alignement issues" in CHECK report is difficult to figure
> out by just doing a glance analysis. :)
>
> Linus also suggested to use bool as the base type i.e., `bool x:1` but
> again sizeof(_Bool) is implementation defined ranging from 1-4 bytes.
If bool x:1 has the size of bool, then wouldn't int x:1 have the size of
int? But my little experiments suggest that the size is the smallest that
fits the requested bits and alignment chosen by the compiler, regardless of
the type.
bool x:1 has the advantage that anything that is not 0 is considered true.
So for bool x:1, x = 4 is true, while for int x:1, x = 4 is false.
But the :1 adds instructions, so at least for only one bool, where little
space is saved, it is probably not worth it.
julia