For the following code
typedef struct {
Uint16 a:2;
Uint16 b:10;
Uint16 c:4;
} abc_type;
abc_type abc = { 5, 17, 2};
Uint16 foo = 123456;
I get the (very helpful) warning
"con_init.c", line 206: warning #70-D: integer conversion resulted in
truncation
Uint16 foo = 123456;
^
Unfortunately, the initialization of abc.a with 5 goes wrong without any compiler message.
Is there a way to make the compiler issue a warning or even an error if the initializer of a bitfield doesn't fit into the bitfield?
Regards
Johannes