Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
8.14 and "involved in a decision to exit the loop"
#2
'x' is involved in the decision to exit the loop if the value returned by 'g' is dependent on the value of 'x'. For example:

Code:
bool g ( int x ) {    return x == 3; }         /* involved in decision to exit the loop */
bool g ( int x ) {    fn(x); return True; }   /* not involved in decision to exit the loop */

The same argument applies to 'h' and 'q'. If the value of 'h' returns a value that is dependent on 'q', then 'q' is involved in the decision to exit the loop.

In general the answer to this question will be undecidable, which is reflected in rules 14.1 and 14.2 being marked as undecidable. Analysis tools are likely to vary in whether they produce False Positives or False Negatives for these rules.
Posted by and on behalf of the MISRA C Working Group
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)