User`s manual
Example 2:
Explicit conversion can also be used when you are sure which type you want to
convert expression to. Consider the following lines:
dim tA as byte
dim tB as byte
dim tC as byte
dim A_ as short
dim B_ as short
tA = byte(A_)
B_ = short(tA + tB * tC)
It is important to understand that explicit conversion between signed and unsigned
data does not change binary representation of data; it only allows copying source
to destination. Thus, if A_ was -1, its binary representation would be 11111111,
and A would become 255.
Even if you have ordered the explicit conversion, compiler will perform implicit if
necessary.
Example 3:
You cannot execute explicit conversion on the operand left of the assignment oper-
ator:
word(b) = Bb
' compiler will report an error.
mikroBASIC
- Basic Compiler for Microchip PIC microcontrollers
64
mikroBASIC
MikroElektronika: Development tools - Books - Compilers
making it simple...
page