uint
ulong 无符号长整形
Type Min Max CLS-compliant
int -2,147,483,648 2,147,483,647 Yes
uint 0 4,294,967,295 No
long –9,223,372,036,854,775,808 9,223,372,036,854,775,807 Yes
ulong 0 18,446,744,073,709,551,615 No
要在源代码中写入一个文字无符号整数,你可以使用后缀u或U例如123U。
如果你希望符合CLS标准,则不应在你的公共界面中使用uint和ulong 。
INT
UINT
long
ulong
=================================================
0xffff 转换成二进制 一个f代表15 转换成二进制是 1111
4个f,所以是1111 1111 1111 1111
2^16 = 65535
LONG_MIN constant:a macro constant which is defined in climits header.It is used to get the minimum value of a long int object, it returns the minimum value that a long int object can store, which is -9223372036854775808 (on 32 bits compiler).
LONG_MIN常量是在climits标头中定义的宏常量,用于获取long int对象的最小值,它返回long int对象可以存储的最小值,即-9223372036854775808 (在32位编译器上) 。
Note:
注意:
The actual value depends on the compiler architecture or library implementation.
实际值取决于编译器体系结构或库实现。
We can also use <limits.h> header file instead of header as LONG_MIN constant is defined in both of the libraries.
我们也可以使用<limits.h>头文件代替头文件,因为在两个库中都定义了LONG_MIN常量 。
// C++ code to demonstrate example of
// LONG_MIN constant with climits header
#include
#include
using namespace std;
int main()
{
//prinitng the value of LONG_MIN
cout<<"LONG_MIN: "<<LONG_MIN<<endl;
return 0;
}
我的机子跑出来是
LONG_MIN: -2147483648