Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Clarification for underlying type of an integer constant expression
#3
Dear MISRA team,

is the underlying type of
Code:
static_cast(1U)

a) uint8_t (underlying type of an integer literal in chapter 6)?

or

b) uint16_t because the static_cast is taken into account (see static_cast(expression) in chapter 6)?

If the answer is a) then it would be impossible to make this line of code compliant with rule 5-0-10, right?

[code]const uint16_t MASK = 1U
<t></t>
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 2 Guest(s)