_int64声明,该如何处理
__int64声明
我用的是Visual Studio 2005编译器
我可以使用 __int64 i; 这种声明,但是在我学习的C基础书里面没有这样的声明,我想请问下 这是编译器自己带的还是
ANSI C 本来就有的啊?
__int64就是把变量声明为64位的变量吧?
------解决方案--------------------
找到宏定义即可 其实也是基本的内置类型
------解决方案--------------------
这是VC里的东西,范围是[-2^63, 2^63)
------解决方案--------------------
只是一个宏而已,一种类型的另一种表达方式罢了
------解决方案--------------------
__int8, __int16, __int32, __int64
Microsoft Specific —>
Microsoft C/C++ features support for sized integer types. You can declare 8-, 16-, 32-, or 64-bit integer variables by using the __intn type specifier, where n is 8, 16, 32, or 64.
The following example declares one variable for each of these 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
The types __int8, __int16, and __int32 are synonyms for the ANSI types that have the same size, and are useful for writing portable code that behaves identically across multiple platforms. 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 ANSI equivalent.
C++ Specific —>
Because __int8, __int16, and __int32 are considered synonyms by the compiler, care should be taken when using these types as arguments to overloaded function calls. The following C++ code generates a compiler error:
void MyFunc( __int8 ) {}
void MyFunc( char ) {}
void main()
{
__int8 newVal;
char MyChar;
MyFunc( MyChar ); // Ambiguous function calls;
MyFunc( newVal ); // char is synonymous with __int8.
}
END C++ Specific
END Microsoft Specific
我用的是Visual Studio 2005编译器
我可以使用 __int64 i; 这种声明,但是在我学习的C基础书里面没有这样的声明,我想请问下 这是编译器自己带的还是
ANSI C 本来就有的啊?
__int64就是把变量声明为64位的变量吧?
------解决方案--------------------
找到宏定义即可 其实也是基本的内置类型
------解决方案--------------------
这是VC里的东西,范围是[-2^63, 2^63)
------解决方案--------------------
只是一个宏而已,一种类型的另一种表达方式罢了
------解决方案--------------------
__int8, __int16, __int32, __int64
Microsoft Specific —>
Microsoft C/C++ features support for sized integer types. You can declare 8-, 16-, 32-, or 64-bit integer variables by using the __intn type specifier, where n is 8, 16, 32, or 64.
The following example declares one variable for each of these 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
The types __int8, __int16, and __int32 are synonyms for the ANSI types that have the same size, and are useful for writing portable code that behaves identically across multiple platforms. 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 ANSI equivalent.
C++ Specific —>
Because __int8, __int16, and __int32 are considered synonyms by the compiler, care should be taken when using these types as arguments to overloaded function calls. The following C++ code generates a compiler error:
void MyFunc( __int8 ) {}
void MyFunc( char ) {}
void main()
{
__int8 newVal;
char MyChar;
MyFunc( MyChar ); // Ambiguous function calls;
MyFunc( newVal ); // char is synonymous with __int8.
}
END C++ Specific
END Microsoft Specific