C 调整了大小的整型C Sized Integer Types

Microsoft 专用Microsoft Specific

Microsoft C 支持固定大小整数类型。Microsoft C features support for sized integer types. 可以使用 __intn 类型说明符声明 8 位、16 位、32 位或 64 位整数变量,其中 n 是整数变量的大小(以位为单位)。You can declare 8-, 16-, 32-, or 64-bit integer variables by using the __intn type specifier, where n is the size, in bits, of the integer variable. n 的值可以是 8、16、32 或 64。The value of n can be 8, 16, 32, or 64. 以下示例为四种类型的固定大小整数各声明了一个变量:The following example declares one variable of each of the four types of sized integers:

__int8 nSmall;      // Declares 8-bit integer  
__int16 nMedium;    // Declares 16-bit integer  
__int32 nLarge;     // Declares 32-bit integer  
__int64 nHuge;      // Declares 64-bit integer  

固定大小整数的前三种类型是大小相同的 ANSI 类型的同义词,用于编写在多个平台中具有相同的行为的可移植代码。The first three types of sized integers are synonyms for the ANSI types that have the same size, and are useful for writing portable code that behaves identically across multiple platforms. 请注意,__int8 数据类型与 char 类型是同义词,__int16 与 short 类型是同义词,__int32 与 int 类型是同义词。__int64 类型没有等效的 ANSI 匹配项。Note that the __int8 data type is synonymous with type char, __int16 is synonymous with type short, and __int32 is synonymous with type int. The __int64 type has no equivalent ANSI counterpart.

结束 Microsoft 专用END Microsoft Specific

另请参阅See Also

基本类型的存储Storage of Basic Types