28-04-2022, 06:18 AM
Hi there,
could anyone help explain the following sentence in the Rationale part of Rule 8.7
as specified by the C standard:
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!
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
it might be accessed inadvertently.
as specified by the C standard:
Quote:If the declaration of an identifier for a function has no storage-class specifier, its linkage
is determined exactly as if it were declared with the storage-class specifier extern. If
the declaration of an identifier for an object has file scope and no storage-class specifier,
its linkage is external.
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!
<t></t>