Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
MISRA C:2012 Rule 10.8 Question
#4
Rule 10.8 applies to composite expressions.

You can address this by one of two methods:
1. Deviate Rule 10.8
2. Separate the concerns, by splitting into two statements:

Assuming int32_t a, b;
int32_t s = a + b; // Addition: may overflow, leading to UB
uint32_t u = (uint32_t) s; // Cast to different essential type
Posted by and on behalf of the MISRA C Working Group
Reply


Messages In This Thread
MISRA C:2012 Rule 10.8 Question - by elfdream - 11-11-2023, 03:29 PM
RE: MISRA C:2012 Rule 10.8 Question - by misra-c - 08-08-2024, 03:37 PM
RE: MISRA C:2012 Rule 10.8 Question - by elfdream - 09-08-2024, 02:14 PM
RE: MISRA C:2012 Rule 10.8 Question - by misra-c - 10-07-2025, 12:54 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)