Calculator
This unit is used by the Expressions unit and contains functions that process calculations with one or two operands and calculation operation. This unit actually generates code for addition, subtraction, multiplication, division, shifts, etc.

Processing Mathematical Operations
Turbo Pascal generates code for all mathemathical operations with two operands by the following procedure.
 
Character Pointer Operations
This procedure checks if operation is PChar ± Integer or PChar ± PChar. If so it generates code and returns True otherwise it returns False.
 
Set Operations
Constant sets are located into temprary buffer and expression Value holds offset to this buffer. Non-constant sets are always expanded to stack frame.
 
String Operations
Constant strings are added in the temporary buffer, while all non-constant string operations are performed in stack frame.
 
Extended Operations
Constant Extended values are always stored in expression Value, while for non-constant expressions numeric constants are stored in code block and FPU instructions are used for calculation.
 
Real Operations
For Real operations code is always generated.
 
Boolean Operations
Boolean operations are similar to integer operations.
 
Pointer Operations
Pointer operations are similar to Integer operations. However, only extended Turbo Pascal syntax allows pointer operations other than equality check.
 
Integer Operations
Many operations in Turbo Pascal can be calculated as integer operations. This applies to pointers, Boolean values, enumerated values and Char values.
 
LongInt Comparison
This procedure generates code to compare two LongInt values. Again, for some special cases shorter code is generated.
 
<< Start < Prev 1 2 Next > End >>

 
 
© 2018 Turbo Pascal | Privacy Policy