Mikroelektronika MIKROE-742 데이터 시트

다운로드
페이지 532
Operators Precedence and Associativity
There are 4 precedence categories in mikroPascal PRO for AVR. Operators in the same
category have equal precedence with each other.
Each category has an associativity rule: left-to-right (
), or right-to-left (

). In the
absence of parentheses, these rules resolve the grouping of expressions with operators
of equal precedence.
Arithmetic Operators
Arithmetic operators are used to perform mathematical computations. They have numer-
ical operands and return numerical results. Since the char operators are technically bytes,
they can be also used as unsigned operands in arithmetic operations.
All arithmetic operators associate from left to right.
156
MIKROELEKTRONIKA
- SOFTWARE AND HARDWARE SOLUTIONS FOR EMBEDDED WORLD
Language Reference
mikroPASCAL PRO for AVR
CHAPTER 5
Precedence Operands Operators
Associativity
4
1
@   not   +   -

3
2
*   /   div   mod   and   shl   shr

2
2
+   -   or   xor

1
2
=   <>   <   >   <=   >=

Operator
Operation
Operands
Result
+
addition
byte, short, word,
integer, longint,
dword, real
byte, short,word,
integer, longint,
dword, real
-
subtraction
byte, short, word,
integer, longint,
dword, real
byte, short,word,
integer, longint,
dword, real
*
multiplication
byte, short, word,
integer, longint,
dword, real
word, integer,
longint, dword,
real
/
division, floating-point
byte, short, word,
integer, longint,
dword, real
real
div
division, rounds down
to nearest integer
byte, short, word,
integer, longint,dword
byte, short,
word, integer,
longint, dword
mod
modulus, returns the
remainder of integer
division (cannot be
used with floatin points)
byte, short, word,
integer, longint,
dword
byte, short,
word, integer,
longint, dword