User`s manual

Scope, or identifier visibility, determines if identifier can be referenced in certain
part of the program code. Location of identifier declaration in the code determines
its scope. Identifiers with narrower scope - especially identifiers declared in func-
tions and procedures - are sometimes called local, while identifiers with wider
scope are called global.
All functions and procedures are visible in the whole project, and they are visible
in any part of the program or any module. Constants not local for a procedure or
function are also visible in the whole project. Local constants are visible only in
procedure or function body in which they are declared.
Rules for determining the variable identifier scope are summarized below:
- If the identifier is declared in the declaration of a main module, it is
visible from the point where it is declared to the end of the module.
- If the identifier is declared in the declaration of function, or procedure, its
scope extends from the point where it is declared to the end of the current
block, including all blocks enclosed within that scope.
- If the identifier is declared in the implementation section of a module, but
not within the block of any function or procedure, its scope extends from
the point where it is declared to the end of the module. The identifier is
available to any function or procedure in the module.
PIC SFR (Special Function Registers), are implicitly declared as global variables
of byte type. Their scope is the entire project and they are visible in any part of the
program or any module.
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
58
mikroBASIC
MikroElektronika: Development tools - Books - Compilers
making it simple...
page
SCOPE (IDENTIFIER VISIBILITY)