Literal types: 0x1ull vs 0x1llu

前端 未结 3 1907
感动是毒
感动是毒 2021-01-18 10:30

My gcc compiler allows me to define an unsigned long long (i.e. 64-bit) literal as

#define A_LITERAL 0x1ull

--- or ---

3条回答
  •  -上瘾入骨i
    2021-01-18 10:39

    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
    

提交回复
热议问题