Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 15.3 Example
#1
Rule 15.3 Example
void f1(int32_t a){
if ( a 0){
L2:
;
}
}
has some unreachable codes. So I think
void f1(int32_t a){
if ( a 0){
L2:
;
}
}
are enough and no unreachable codes.

Dr. Ogawa Kiyoshi
https://twitter.com/kaizen_nagoya/, http://researchmap.jp/kaizen/MISRA-C/
<t>Dr. OGAWA Kioshi<br/>
@kaizen_nagoya</t>
Reply
#2
Thank you for your comment. The examples in the guidelines have be written with an attempt to minimise violations with other guidelines. However, in some examples other guidelines are violated in order to keep the example concise.

In this example the first "goto L1;" demonstrates that a jump to the same level of block is compliant. In hindsight it might have been clearer to have had another label "L3" to have demonstrated this point.
Posted by and on behalf of the MISRA C Working Group
Reply


Forum Jump:


Users browsing this thread: 3 Guest(s)