Re: Is "scope" different from "visibility" ?

From: Ben Pfaff (blp_at_cs.stanford.edu)
Date: 02/10/05


Date: Thu, 10 Feb 2005 10:03:41 -0800

Jack Klein <jackklein@spamcop.net> writes:

> On 9 Feb 2005 20:04:04 -0800, "TTroy" <tinesan@gmail.com> wrote in
> comp.lang.c:
>
>> I have a few questions about "scope" and "visibility," which seem like
>> two different things.
>
> Scope is something defined by the C standard. "visibility" is not.

The standard does not specifically define "visibility" but it
does use the term "visible" a fair amount, e.g.:

     For each different entity that an identifier designates,
     the identifier is visible (i.e., can be used) only within a
     region of program text called its scope.
...
     Within the inner scope, the identifier designates the entity
     declared in the inner scope; the entity declared in the
     outer scope is hidden (and not visible) within the inner
     scope.

     Unless explicitly stated otherwise, where this International
     Standard uses the term ``identifier'' to refer to some
     entity (as opposed to the syntactic construct), it refers to
     the entity in the relevant name space whose declaration is
     visible at the point the identifier occurs.
...
     If more than one declaration of a particular identifier is
     visible at any point in a translation unit, the syntactic
     context disambiguates uses that refer to different entities.

-- 
"I should killfile you where you stand, worthless human." --Kaz


Relevant Pages

  • Re: How to eliminate this global variable, silent?
    ... identifier. ... (But given the way the C standard uses the term "name", ... We can and do refer to that object as a. ... Somebody else can just as easily construct another ...
    (comp.lang.c)
  • Re: string v.s. basic_string
    ... the standard (and MSFT's own guidelines regarding identifier names at "file ... scope"). ...
    (microsoft.public.vc.language)
  • Re: types, variable names and fields
    ... No, assuming the same scope, no two typedefs, objects, or functions ... determine what declaration an identifier refers to. ... For structure/union tags and members, ... declarator or type specifier). ...
    (comp.lang.c)
  • Re: Array definition guarantees
    ... linkage tells you where, ... identifier that is spelled sufficiently similarly. ... I think it is closer to say that scope tells you where the name ... The second glitch in this is the "extern" keyword. ...
    (comp.lang.c)
  • Re: Array definition guarantees
    ... linkage tells you where, ... identifier that is spelled sufficiently similarly. ... I think it is closer to say that scope tells you where the name ... The second glitch in this is the "extern" keyword. ...
    (comp.lang.c)