Rule 5-2-7 - 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++:2008 rules (https://forum.misra.org.uk/forumdisplay.php?fid=19) +---- Forum: 6.5 Expressions (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=134) +---- Thread: Rule 5-2-7 (/showthread.php?tid=1248) |
Rule 5-2-7 - dg1980 - 24-05-2016 Dear MISRA team, IMHO, this rule is missing one important exception: casting to [unsigned]char* to access individual bytes is well defined in the standard (chapter 3.9 § 2) In fact, you find this exception in MISRA C 2012 Rule 11.3. Re: Rule 5-2-7 - misra cpp - 11-10-2016 One of the differences between C and C++ is that all structs in C are PODs. The section you reference of the C++ standard only applies to POD structs. In general this operation is unspecified in C++. In the narrow case where the behaviour is well defined, it could be allowed by deviation. A future version will remove the need for the deviation where this behaviour is well defined |