Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Doubt on rule 13.2
#3
Hi Lundin,

in this moment I am not concerned about good programming practice, but on the genuine interpretation of MISRA rules.
In particular, when y is a pointer,
Code:
if ( y ) ...
is not testing a value against zero: it is testing the validity of a pointer and, as you write, this may have nothing to do with zero.
This reasoning made me think that, perhaps, there is an oversight in the example given on page 65 of MISRA-C:2004: perhaps it should read
Code:
if ( y ) /* Not compliant, unless y is effectively Boolean data
               (e.g. a flag) or a pointer.  */
Can the MISRA committee shed some light on this?
Thanks,

Roberto
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)