User manual

mikroPascal PRO for PIC32
MikroElektronika
211
circle1.radius := 3.7;
circle1.center.x := 0;
circle1.center.y := 0;
Accessing the elds is possible via the with statement as well.
You can also commit assignments between complex variables, if they are of the same type:
circle2 := circle1; // This will copy values of all elds
Types Conversions
Conversion of variable of one type to a variable of another type is typecasting. mikroPascal PRO for PIC32 supports
both implicit and explicit conversions for built-in types.
Implicit Conversion
Compiler will provide an automatic implicit conversion in the following situations:
- statement requires an expression of particular type (according to language denition), and we use an expression of
different type,
- operator requires an operand of particular type, and we use an operand of different type,
- function requires a formal parameter of particular type, and we pass it an object of different type,
- result does not match the declared function return type.
Promotion
When operands are of different types, implicit conversion promotes the less complex type to more complex type taking
the following steps:
bit → byte/char
byte/char → word
short → integer
short → longint
integer → longint
integer → real
Higher bytes of extended unsigned operand are lled with zeroes. Higher bytes of extended signed operand are lled
with bit sign (if number is negative, ll higher bytes with one, otherwise with zeroes). For example:
var a : byte; b : word;
...
a := $FF;
b := a; // a is promoted to word, b becomes $00FF