06-06-2017, 09:54 AM
MISRA C 2012 guideline says:
Strong typing requires the controlling expression of an if statement or iteration-statement to have
essentially Boolean type.
For example:
typedef unsigned short tudtKalEvents;
#define udtSTOP_EVENT (tudtKalEvents)0x0001;
I think the code is ok, I use the & statement as the conditional expression. As we know, the value is not equal to zero, the condition shall be judged to be true,
why We must use the boolean type?
Strong typing requires the controlling expression of an if statement or iteration-statement to have
essentially Boolean type.
For example:
typedef unsigned short tudtKalEvents;
#define udtSTOP_EVENT (tudtKalEvents)0x0001;
Code:
if(udtEvents & (tudtKalEvents) udtSTOP_EVENT)
{
vidStop();
}
why We must use the boolean type?
<t></t>