C程序中看到有人赋值是 a = 1024*1024*1024ULL; 这个ULL是什么意思啊

Python09

C程序中看到有人赋值是 a = 1024*1024*1024ULL; 这个ULL是什么意思啊,第1张

小兄弟,你只知其一不知其二啊!,不加ull那么1024*1024*1024得到的会是一个int类型的值,因为1024*1024*1024结果并没有超出int类型的范围,当然不会有错,你只需要再在后面乘以一个2就会有明显的效果了

1024*1024*1024*2ULL

1024*1024*1024*2

看看上面这两组,下面不加ull的值就是错误的!

1、整型int2(或4)同短整型(或长整型)

2、短整型short2-32768~32767

3、长整型long4-2的31次方~2的31次方-1

4、无符号整型unsigned[int]2(或4)同无符号短整型(长整型)

5、无符号短整型unsignedshort20~65535(0~2的16次方-1)

6、无符号长整型unsignedlong40~2的32次方-1

7、单精度实型float4-10的38次方~10的38次方

8、双精度实型double8-10的308次方~10的308次方

9、字符型char1-128~127

扩展资料

unsignedlong的使用

例:

#include<cstdio>

intmain()

{

unsignedintui=-1

unsignedlongul=-1

unsignedlonglongull=-1

size_tst=-1

printf("ui=%u,ul=%lu,ull=%llu,st=%zu\n",ui,ul,ull,st)

return0

}

The ARM compiler-specific __ESCAPE__ built-in allows the standard headers to use certain extended language features (such as ull) even in --strict mode.

ARM编译器指定的内建宏,它允许标准头文件使用某些扩展功能(例如ull)即使是--strict模式启用也是如此。

The details and behaviour of this internal feature may change from release to release of the compiler. It is not intended to be used directly by end users.

详情和具体行为可能随着版本不断变化,这不应该是终端用户使用的。

除了这个功能外,相当于

#define __ESCAPE__(x) x

##的意思就是文本拼接x##ull,如果x是1000,那就是1000ull。