PPC bool bitfield

I was working on a library to make some tasks easier on the cRIO, and the library contained a bitfield that looks like this:

union ORArgs
	unsigned char Value;
	struct b
		bool b0 : 1,
		b1 : 1, 
		b2 : 1, 
		b3 : 1, 
		b4 : 1, 
		b5 : 1, 
		b6 : 1, 
		b7 : 1;
	} Bits;

later, I read that bools are 4 bytes on a PPC system, which we have in the crio, and was wondering if the four bytes would cause undesired effects, like set b0,b1,b2, and b3 to true if b1 is set to true, but after thinking about it for a while, I thought that the first bit of bool b0 would equal the first bit of char Value, and the rest of the bits would be “discarded”. unfortunately, I won’t have access to the cRIO for another week. Is my first thought or second thought the true one?

I don’t think either is correct.

The “: 1” part of the definition specifies how many bits wide to make the element. If the compiler does what it is hinted to do, the eight booleans will take up exactly one byte. That will map precisely onto the one-byte char also defined in the union.

Since you’re specifying the type “bool”, I believe the first four make up one bool variable, and the next 4 make up a second bool variable. If you made it a 10-bit bitfield, you’d end up with bool variables and 2 unused bits. At least, that’s my understanding. From what I’ve read on bitfields, that code should be fine. The variable type declarations are really more just the computer’s version of bureaucracy, it tells it how to write the memory addresses.