Rule 16.8 and 14.7 - 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: 2004 rules (https://forum.misra.org.uk/forumdisplay.php?fid=17) +---- Forum: 6.16 Functions (https://forum.misra.org.uk/forumdisplay.php?fid=47) +---- Thread: Rule 16.8 and 14.7 (/showthread.php?tid=871) |
Rule 16.8 and 14.7 - jpmzometa - 06-01-2012 In rule 16.8 is stated All exit paths from a function... whereas rule 14.7 states A function shall have a single point of exit... Is there a difference between "exit path" and "point of exit"? If not, should rule 16.8 be interpreted as beginning with "The single point of exit from a function..."? Regards, Re: Rule 16.8 and 14.7 - misra-c - 11-01-2012 Rule 14.7 requires that a function have a single point of exit. However if the rule is deviated, a function might have multiple points of exit. In this case, it is still important that each point of exit in a non-void function return a value. So, Rule 16.8 should be interpreted as applying to *all* points of exit even though this will usually be a single point of exit. There is no significance in the use of the word "path" in rule 16.8. An exit path must pass through an exit point so the rule could also be interpreted as saying "All exit points from a function ... " |