Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 13.3 incr/decr op in initialization
#1
Based on the example in MISRA 2023 C this is non-compliant:
Code:
  int u8a=0;  // implied
  u8a = u8b++;  //don't accept assignment and increment on the same line

  but what about in initialization? According to PCLP tool it's acceptable:
Code:
  int u8a = u8b++;

My view is that de/increment shouldn't be mixed with anything and it should be alone in one line to avoid any chance of confusion.

Please clarify.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)