I have a bitfield:
struct MyBitfield {
unsigned char field1: 1;
unsigned char field2: 1;
};
These bitfield arguments are 1 bit wide and represent boolean values. I was wondering if it is valid to initialize it with bools as follows
MyBitfield my_bitfield = {true, false};
My question is whether this behavior is well defined. IIUC, false always evaluates to 0 but true can evaluate to any non-zero integer. If it happens to evaluate to an integer whose LSB is 0, will it be cast to the bit 0 and evaluate to false or does the language guarantee that it will always be cast to the bit 1?