Microsoft C/C函数支持大小整数类型。
可以声明的8位、16位、32位或64位整数使用__intn的64位整数变量类型说明符。 其中n是8、16、32或64。
以下示例声明这些类型的大小整数中的每个变量:
__int8 nSmall; //declares 8位integer
__int16 nMedium; //declares 16 -位integer
__int32 nLarge; //declares 32位integer
__int64 nHuge; //declares 64位integer
大小整数的前三种类型为__int8,__int16,与__int32大小相同的ANSI类型同义词,用于在多个平台上以相同的行为编写便携式代码。 __int8数据类型与类型char同义。 __int16是类型short的同义词。 __int32与类型int同义。 __int64类型没有ANSI等效项。
在以下示例中,__intxx参数将升级为int:
//sized_int_types.cpp
#包含
语音功能(Inti ) {
printf_s('%sn ',__FUNCTION__ );
}
int main () )
{
__int8 i8=100;
func(I8; //novoidfunc(_int8I8) function
//__int8 will be promoted to int
}