c - 文字类型 : 0x1ull vs 0x1llu

标签 c literals

我的 gcc 编译器允许我将 unsigned long long(即 64 位)文字定义为

#define A_LITERAL 0x1ull

--- 或 ---

#define A_LITERAL 0x1llu

这两个文字陈述之间有什么区别吗?这对其他 C 编译器来说很常见吗?

最佳答案

两者相同:摘自 C++11 标准的 n3337 草案:

integer-suffix:
    unsigned-suffix long-suffix(opt)
    unsigned-suffix long-long-suffix(opt)
    long-suffix unsigned-suffix(opt)
    long-long-suffix unsigned-suffix(opt)

unsigned-suffix: one of
    u U

long-suffix: one of
    l L

long-long-suffix: one of
    ll LL

关于c - 文字类型 : 0x1ull vs 0x1llu,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17287680/

相关文章:

c++ - C 和 C++ 中的多字 rune 字

c - 理解应用于文字时 C 指针转换的语义

javascript - HTML 模板到 Javascript 字符串文字

C++ const 字符串文字和自定义字符串类

c - 如何计算C中两组之间的差异?

c - 陷入 for 循环,用 C 语言向数组输入值

c - 使用 while 循环遍历作为 C 中的参数接收的 char 数组

c - Wire.read 返回有符号或无符号值

python - YAML 中映射的映射中的文字

c - : in scanf?的目的是什么