Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Rule 7.0.4 - example not compliant with 7.0.5?
#1
Hi,

Rule 7.0.4 provides this example as compliant, and does not violate other rules  (like other examples)

Code:
static_cast< uint16_t >( u8 + u16 ) << 2;  // Compliant

Why doesn't this example violate 7.0.5? Bit shift applied on uint16_t will cause integral promotion from uint16_t to int, thus violating 7.0.5, or?

Thanks!
Reply
#2
Your right, it does. It should say '// Compliant - but violates other rules'

A note has been made to update the document accordingly
Posted by and on behalf of
the MISRA C++ Working Group
Reply
#3
Thanks for the clarification!
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)