According to Autosar_SWS the boolean must be unsigned char
.
But I am having lots of MISRA violation in my compositions, like MISRA rule 10.1 (conversion violation), Rule 12.6 (effective boolean).
I would like to know if I redefine the BOOLEAN for my application like below:
#ifdefine BOOLEAN_T
#undefine BOOLEAN_T
typedef struct {
unsigned char TRUE : 1;
unsigned char FALSE : 1;
} BOOLEAN_T;
#define TRUE 1;
#define False 0;
#endif
What will be the safety concerns and the consequences?
For safety you can use for example a bit pattern:
unsigned char data = 0x55 << (input_bit & 1);
switch (data):/* instead of if() */
case 0xaa:
/*true*/
break;
case 0x55:
/*false*/
break;
case default:
/*exception*/
break;
}