Visibility
The visibility of an identifier is that region of the program source code from which
legal access can be made to the identifier’s associated object.
Scope and visibility usually coincide, though there are circumstances under which
an object becomes temporarily hidden by the appearance of a duplicate identifier:
the object still exists but the original identifier cannot be used to access it until the
scope of the duplicate identifier is ended.
Technically, visibility cannot exceed scope, but scope can exceed visibility. Take a
look at the following example:
void f (int i) {
int j;
// auto by default
j = 3;
// int i and j are in scope and visible
{
// nested block
double j;
// j is local name in the nested block
j = 0.1;
// i and double j are visible;
// int j = 3 in scope but hidden
}
// double j out of scope
j += 1;
// int j visible and = 4
}
// i and j are both out of scope
MikroElektronika:
Development
tools
-
Books
-
Compilers
55
page
mikroC
- C Compiler for Microchip PIC microcontrollers
mikroC
making it simple...