User manual

mikroPascal PRO for dsPIC30/33 and PIC24
MikroElektronika
222
If the operand is a parameter declared as array type or function type, sizeof gives the size of the pointer. When
applied to records, sizeof gives the total number of bytes, including any padding. The operator sizeof cannot be
applied to a function.
Expressions
An expression is a sequence of operators, operands and punctuators that returns a value.
The primary expressions include: literals, constants, variables and function calls. More complex expressions can be
created from primary expressions by using operators. Formally, expressions are dened recursively: subexpressions
can be nested up to the limits of memory.
Expressions are evaluated according to certain conversion, grouping, associativity and precedence rules which depend
on the operators in use, presence of parentheses and data types of the operands. The precedence and associativity of
the operators are summarized in Operator Precedence and Associativity. The way operands and subexpressions are
grouped does not necessarily specify the actual order in which they are evaluated by mikroPascal PRO for PIC.
Expression Evaluation
General Rule
Expression are evaluated according to the right side operands. Operations are done at higher operand level, with
signed operands taking precedence.
Example:
a : byte;
b : word;
c : integer;
a * b // word level
a * c // integer level
b * c // integer level
Left side exception
In arithmetic expression left side is considered in the following manner : If the left side size in bytes is greater than
higher operand size, then evaluation is done at one level above higher operand level (to get correct calculations).
Example:
a: dword;
b: byte;
a := b * 5; // this is done at word level