Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 15.5
#1
Rule 15.5 is "A function should have a single point of exit at the end".

The Rationale of this rule says:

Early returns may lead to the unintentional omission of function termination code.

1. What is "function termination code" in this context? Does it mean user defined C statements of the function or the function epilogue after the compilation?

2. If it is the function epilogue, then does it mean that when multiple exit points are used, then it MAY result in imbalanced context retrieval when the function returns, for some compilers?
<t></t>
Reply
#2
For cross-reference, originally discussed on LinkedIn ISO26262 group

http://lnkd.in/dJZd7FR
<r>-----<br/>
Andrew Banks<br/>
Chairman, MISRA C WG<br/>
<B><s></s>Posting in a personal capacity<e></e></B></r>
Reply
#3
The statement refers to C statements written by the user. For example a function might intend to always free allocated space, close a file, or make some other change to the program state. This change is likely to have been coded at the end of the function and might not be reached if the function also has an earlier point of exit.
Posted by and on behalf of the MISRA C Working Group
Reply
#4
Thanks very much for the reply.
<t></t>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)