next up previous contents index search.gif
Next: 6.5 The @ operator Up: 6. Expressions Previous: 6.3 Set constructors

6.4 Value typecasts

Sometimes it is necessary to change the type of an expression, or a part of the expression, to be able to be assignment compatible. This is done through a value typecast. The syntax diagram for a value typecast is as follows:

Typecasts

\begin{syntdiag}\setlength {\sdmidskip}{.5em}\sffamily\sloppy \synt{value\ typecast}
\synt{type\ identifier}
\lit* (
\synt{expression}
\lit* )\end{syntdiag}
Value typecasts cannot be used on the left side of assignments, as variable typecasts. Here are some valid typecasts:

Byte('A')
Char(48)
boolean(1)
longint(@Buffer)
The type size of the expression and the size of the type cast must be the same. That is, the following doesn't work:

Integer('A')
Char(4875)
boolean(100)
Word(@Buffer)


root
1999-06-10