64位整数的编译错误

在用GCC编译下面的代码时出现以下错误:integer constant is too large for 'long' type

unsigned long long m_qtFlags = (m_qtFlags&0xffffffff00000000)|Flags;

 google了一下发现原因如下:unsigned long long是64位整数,而编译器在解析没有后缀的常量时会尝试解析成int,而0xffffffff00000000超过了int的范围,所以会报warning或者error

解决方法:在常量后面加ULL告诉编译器这是一个64位整数

原文地址:https://www.cnblogs.com/hyamw/p/2354111.html