Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Further guidance on MISRA-C 2012 Rule 10.6
#2
C18 para 6.5.3.4 defines that sizeof(x) generates an unsigned integer constant (long or long long?) and is therefore not within the scope of MISRA C Appendix D.7

By MISRA C Appendix D.6.1(2) an integer constant of unsigned type is the UTLR of the value (hence essentially unsigned char)

Case 1: uint32_t = ( uint8_t + uint8_t ) + uint16_t
==> uint8_t + uint16_t /* Non-compliant - widened u16 -> u32 */
Case 2: uint32_t = uint32_t + uint32_t + uint16_t /* Compliant - all in u32 */
Case 3: uint32_t = uint8_t + ( uint8_t + uint16_t ) /* Non-compliant */
Case 4: uint32_t = uint8_t + uint16_t + uint8_t /* Non-compliant */
Posted by and on behalf of the MISRA C Working Group
Reply


Messages In This Thread
RE: Further guidance on MISRA-C 2012 Rule 10.6 - by misra-c - 08-08-2024, 03:29 PM

Forum Jump:


Users browsing this thread: 2 Guest(s)