Difference between 2-10-2 and MISRA C-2012 Rule 5.3 - 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.2 Lexical conventions (C++) (https://forum.misra.org.uk/forumdisplay.php?fid=131) +---- Thread: Difference between 2-10-2 and MISRA C-2012 Rule 5.3 (/showthread.php?tid=1455) |
Difference between 2-10-2 and MISRA C-2012 Rule 5.3 - cxlin - 19-09-2018 Hi, MISRA C-2012 Rule 5.3 (which is of the same title as 2-10-2) has this additional amplification about an identifier declared in an inner scope shall be distinct from *any* id declared in an outer scope. So the following code shall be a violation for 5.3 although the inner "i" is not hiding the outer "i" (still confusing though). Code: void f() { Since 2-10-2 does not have this amplification, could you kindly help to advise whether this is also a violation for 2-10-2 or not? Re: Difference between 2-10-2 and MISRA C-2012 Rule 5.3 - misra cpp - 25-10-2018 It was not our intention to make the example you quote illegal, as there is no hiding involved. We’ll pass you observation on to MISRA C |