Rule 8.7: clarifications of no linkage for an object - Printable Version +- MISRA Discussion Forums (https://forum.misra.org.uk) +-- Forum: MISRA C (https://forum.misra.org.uk/forumdisplay.php?fid=4) +--- Forum: MISRA C:2012 and MISRA C:2023 guidelines (https://forum.misra.org.uk/forumdisplay.php?fid=21) +---- Forum: 8.8 Declarations and defnitions (https://forum.misra.org.uk/forumdisplay.php?fid=163) +---- Thread: Rule 8.7: clarifications of no linkage for an object (/showthread.php?tid=1618) |
Rule 8.7: clarifications of no linkage for an object - chenzhuowansui - 28-04-2022 Hi there, could anyone help explain the following sentence in the Rationale part of Rule 8.7 Quote:Restricting the visibility of an object by giving it internal linkage or no linkage reduces the chance that as specified by the C standard: Quote:If the declaration of an identifier for a function has no storage-class specifier, its linkage if an object is declared with no linkage, the default linkage is external linkage, so why giving no linkage to an object could restrict the visibility and reduces the chance that it might be accessed inadvertently? thanks! RE: Rule 8.7: clarifications of no linkage for an object - misra-c - 02-07-2024 There is a difference between "no linkage" and "no explicit linkage". We will tweak the wording of R.8.7 in a future revision: "... by giving it internal linkage or no linkage reduces the chance ..." to "... by giving it internal linkage or defining it at block scope reduces the chance ..." |