User manual

Table Of Contents
mikroC PRO for PIC32
MikroElektronika
193
Lvalues
Lvalue is an object locator: an expression that designates an object. An example of lvalue expression is *P, where P is
any expression evaluating to a non-null pointer. A modiable lvalue is an identier or expression that relates to an object
that can be accessed and legally changed in memory. A const pointer to a constant, for example, is not a modiable
lvalue. A pointer to a constant can be changed (but its dereferenced value cannot).
Historically, l stood for “left”, meaning that lvalue could legally stand on the left (the receiving end) of an assignment
statement. Now only modiable lvalues can legally stand to the left of an assignment operator. For example, if a and
b are nonconstant integer identiers with properly allocated memory storage, they are both modiable lvalues, and
assignments such as a = 1 and b = a + b are legal.
Rvalues
The expression a + b is not lvalue: a + b = a is illegal because the expression on the left is not related to an object.
Such expressions are sometimes called rvalues (short for right values).
Scope and Visibility
Scope
The scope of an identier is a part of the program in which the identier can be used to access its object. There are
different categories of scope: block (or local), function, function prototype, and le. These categories depend on how
and where identiers are declared.
- Block: The scope of an identier with block (or local) scope starts at the declaration point and ends at
the end of the block containing the declaration (such block is known as the enclosing block). Parameter
declarations with a function denition also have block scope, limited to the scope of the function body.
- File: File scope identiers, also known as globals, are declared outside of all blocks; their scope is from the
point of declaration to the end of the source le.
- Function: The only identiers having function scope are statement labels. Label names can be used with
goto statements anywhere in the function in which the label is declared. Labels are declared implicitly by
writing label_name: followed by a statement. Label names must be unique within a function.
- Function prototype: Identiers declared within the list of parameter declarations in a function prototype
(not as a part of a function denition) have a function prototype scope. This scope ends at the end of the
function prototype.
Visibility
The visibility of an identier is a region of the program source code from which an identier’s associated object can be
legally accessed.
Scope and visibility usually coincide, though there are circumstances under which an object becomes temporarily
hidden by the appearance of a duplicate identier: the object still exists but the original identier cannot be used to
access it until the scope of the duplicate identier ends.