Originale-mail to me for new edition

 

Value typecasts

 

In a value typecast, the type identifier and the cast expression must both be ordinal types or both be pointer types. Examples of value typecasts include

Integer('A')

Char(48)

Boolean(0)

Color(2)

Longint(@Buffer)

The resulting value is obtained by converting the expression in parentheses. This may involve truncation or extension if the size of the specified type differs from that of the expression. The expression’s sign is always preserved.

The statement

I := Integer('A');

assigns the value of Integer('A'), that is, 65 to the variable I.

A value typecast cannot be followed by qualifiers and cannot appear on the left side of an assignment statement.

 

Topic groups

 

See also

Typecasts: Overview

Variable typecasts

 

 

译文

 

值类型转换

 

在值类型转换中,类型标识符和被转换的表达式必须都是序数类型或都是指针类型。下面是值类型转换的范例:

Integer('A')

Char(48)

Boolean(0)

Color(2)

Longint(@Buffer)

返回值是通过圆括号中的表达式得到的。这可能涉及根据指定的类型(不同于表达式的值的类型)对表达式的值截断或扩充。表达式的符号总是被保持。

语句

I := Integer('A');

Integer('A')的值赋给变量 I ,也就是说,将65赋给变量 I

值类型转换不能跟随在限定词之后,也不能出现在赋值语句的左边。

 

主题组

 

相关主题

类型转换:概述

变量类型转换