Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
What is the UTLR of -1?
#2
(09-06-2026, 09:36 AM)Loïc Wrote: I'm attempting to determine the essential type of the following expression:

Code:
(unsigned short)1 - (unsigned short)2

This is a operation subject to arithmetic conversion (D.7.9), both operands are essentially unsigned, and the expression is an integer constant expression, so according to item 4.1, the essential type of the result is the UTLR of the result.

However, the result is a signed integer with the value -1.

From a C language perspective, integer promotion will be in effect here, so the result is an int with the value of -1

This has highlighted a gap in the UTLR definition, which the MISRA C WG will consider [ID: 480 applies]
Posted by and on behalf of the MISRA C Working Group
Reply


Messages In This Thread
What is the UTLR of -1? - by Loïc - 09-06-2026, 09:36 AM
RE: What is the UTLR of -1? - by misra-c - 08-10-2026, 12:15 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)