Rule 7.0.4 - example not compliant with 7.0.5? - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C++ (https://forum.misra.org.uk/forumdisplay.php?fid=18) +--- Forum: MISRA C++:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=188) +---- Forum: 4.7 Standard conversions (https://forum.misra.org.uk/forumdisplay.php?fid=193) +---- Thread: Rule 7.0.4 - example not compliant with 7.0.5? (/showthread.php?tid=1703) |
Rule 7.0.4 - example not compliant with 7.0.5? - cgpzs - 12-09-2024 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! RE: Rule 7.0.4 - example not compliant with 7.0.5? - misra cpp - 13-09-2024 Your right, it does. It should say '// Compliant - but violates other rules' A note has been made to update the document accordingly RE: Rule 7.0.4 - example not compliant with 7.0.5? - cgpzs - 16-09-2024 Thanks for the clarification! |