Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
No operators in #if
#5
Well, I could change my code to suit the checker, but that's the tail wagging the dog, isn't it?

My view is that the constants 0 and 1 on their own do not have an ET because they could be interpreted as either boolean or as signed int. It is only when an operator is applied that an ET can be assigned. So in !1, 1 has an ET of boolean but in -1, 1 has an ET of signed int. This checker has assumed that 0 and 1 are signed ints, regardless of operators, so !, && and || are not permitted. I find it hard to believe that it was the intention of the MISRA group to prohibit the use of these operators in #if, especially by doing it implicitly through the rules for ETs.


Messages In This Thread

Forum Jump:


Users browsing this thread: 4 Guest(s)