Originale-mail to me for new edition

 

Type compatibility

 

Every type is compatible with itself. Two distinct types are compatible if they satisfy at least one of the following conditions.

·They are both real types.

·They are both integer types.

·One type is a subrange of the other.

·Both types are subranges of the same type.

·Both are set types with compatible base types.

·Both are packed-string types with the same number of components.

·One is a string type and the other is a string, packed-string, or Char type.

·One type is Variant and the other is an integer, real, string, character, or Boolean type.

·Both are class, class-reference, or interface types, and one type is derived from the other.

·One type is PChar or PWideChar and the other is a zero-based character array of the form array[0..n] of Char.

·One type is Pointer (an untyped pointer) and the other is any pointer type.

·Both types are (typed) pointers to the same type and the {$T+} compiler directive is in effect.

·Both are procedural types with the same result type, the same number of parameters, and type-identity between parameters in corresponding positions.

 

Topic groups

 

See also

Assignment-compaibility

Type compatibility and identity: Overview

Type identity

 

 

译文

 

类型兼容

 

每个类型与其自身是兼容的。两个类型是兼容的,如果它们至少满足下列条件之一:

· 它们都是实数类型。

· 它们都是整数类型。

· 一个类型是另一个类型的子界

· 二者都是相同类型的子界

· 二者都是基类型兼容的集合类型

· 二者都是元件数量相同的压缩串类型

· 一个是串类型,另一个是串、压缩串或Char类型

· 一个类型是标准变体Variant,另一个是整数、实数、串、字符或布尔类型。

· 二者都是类、类引用或接口类型,并且一个类型起源于另一个。

· 一个类型是PCharPWideChar,并且另一个是形如array[0..n] of Char的零基数组。

· 一个类型是Pointer (无类型指针),并且另一个是任何指针类型。

· 二者都是相同类型的指针(类型指针),并且编译指示 {$T+} 有效。

· 二者都是具有相同返回类型、相同参数个数、相应位置的参数其类型等同的程序型类型。

 

主题组

 

相关主题

赋值兼容

类型见同和等同:概述

类型等同