User manual
mikroPascal PRO for PIC32
MikroElektronika
189
{ functions declarations }
function function_name([var] [const] ParamName : [^]type; [var] [const] ParamName2,
ParamName3 : [^]type) : [^]type; [ilevel 0x123;] [overload;] [forward;]
{ local declarations }
begin
...
end;
end.
Note :
- Constants, types and variables used in the implementation section are inaccessible to other units. This feature is not
applied to the procedures and functions in the current version, but it will be added to the future ones.
- Functions and procedures must have the same declarations in the interface and implementation section. Otherwise,
compiler will report an error.
Scope and Visibility
Scope
The scope of an identier is a part of the program in which the identier can be used to access its object. There are
different categories of scope, which depends on how and where identiers are declared:
Place of declaration Scope
Identier is declared in the declaration of a
program, function, or procedure
Scope extends from the point where it is declared to the end of the
current block, including all blocks enclosed within that scope. Identiers
in the outermost scope (le scope) of the main unit are referred to as
globals, while other identiers are locals.
Identier is declared in the interface section
of a unit
Scope extends the interface section of a unit from the point where it is
declared to the end of the unit, and to any other unit or program that
uses that unit.
Identier is declared in the implementation
section of a unit, but not within the block of
any function or procedure
Scope extends from the point where it is declared to the end of the unit.
The identier is available to any function or procedure in the unit.
Visibility
The visibility of an identier is that region of the program source code from which legal access to the identier’s
associated object can be made.
Scope and visibility usually coincide, though there are circumstances under which an object becomes temporarily
hidden by the appearance of a duplicate identier, i.e. the object still exists but the original identier cannot be used to
access it until the scope of the duplicate identier is ended.
Technically, visibility cannot exceed scope, but scope can exceed visibility