Re: [PATCH 1/3] Revert "staging: mmal-vchiq: Avoid use of bool in structures"

From: Dan Carpenter
Date: Fri Nov 18 2022 - 03:37:00 EST


On Fri, Nov 18, 2022 at 01:12:32AM +0100, Andrew Lunn wrote:
>
> Does :1 really initialise the variable?

Obviously not.

> In "u32 enabled:1" it means
> this is a 1 bit wide bit field. It seems odd that bool is somehow
> special and :1 means something else.

If you have a bunch of consecutive bool a:1; bool b:1; then GCC will
squeeze them into the same byte. But if you have bool a; bool b; then
they each take a byte with GCC. I have specified GCC because the size
of bool types are a bit vague in the C standard.

regards,
dan carpenter