8.14 and "involved in a decision to exit the loop" - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4) +--- Forum: MISRA C:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21) +---- Forum: 8.14 Control statement expressions (https://forum.misra.org.uk/forumdisplay.php?fid=169) +---- Thread: 8.14 and "involved in a decision to exit the loop" (/showthread.php?tid=961) |
8.14 and "involved in a decision to exit the loop" - gs - 01-05-2013 Section 8.14 defines a loop counter as "an object, array element or member of a structure or union which"
Code: ... What of Code: ... Re: 8.14 and "involved in a decision to exit the loop" - misra-c - 01-07-2013 '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 */ 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. |