User`s manual
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
Notes for Relation Operators
Comparing variable or constant to variable or constant will always produce correct
results.
Comparing expressions requires a little more attention - when compiler is calculat-
ing value of the expression to be compared, it first has to evaluate the expression.
If the result of the expression exceeds the range of the largest data type in the
expression, comparison will most likely be inaccurate. This can be avoided by
using the explicit conversion.
More details can be found in chapter Implicit Conversion and Relation Operators.
PIC MCUs are optimized for working with bytes. It takes less time to add two
bytes than to add two words, naturally, and similar pattern is followed by all the
other operators. It is a good practice to use byte or short data type whenever
appropriate. Although the improvement may seem insignificant, it could prove
valuable for applications which impose execution within time boundaries.
This is a recommendation which shouldn't be followed too literally - word, integer
and longint are indispensable in certain situations.
MikroElektronika:
Development
tools
-
Books
-
Compilers
mikroBASIC
making it simple...
75
page
Runtime Behavior