Literal types: 0x1ull vs 0x1llu

落爺英雄遲暮 提交于 2019-12-01 18:06:44

Both are allowed by the C standard (section 6.4.4.1).

The unsigned suffix u can be before or after the long l (or long long (ll)) suffix.

Mats Petersson

Both are the same: excerpt from n3337 draft of C++11 standard:

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

ull or llu force the compiler to treat a constant as an unsigned and long long integer.
The order of ll and u doesn't matter, nor their case. you may also write LLU or ULL.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!