Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 15.5 and return statements as children of labels
#3
The compound statement that forms the body of the function refers to the outer { } braces of the function - not any inner compound statement.

Therefore, your first example violates R.15.5 - it also violates Mandatory R.17.4 as there is no return statement in the path when the condition is false.

In your second example, a labelled-statement is formed by an id followed by a statement - therefore, the use of a labelled return is not a violation or R.15.5
Posted by and on behalf of the MISRA C Working Group


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)