warning:integer constant is too large for long type

疑问描述

Keywords: EDK, long long integer, 64-bit, SW, mb-gcc, powerpc-eabi-gcc, compiler, C/C++ , g++

When I define a long long integer data type in SW application in EDK, a warning / error similar to the following occurs:

"warning: integer constant is too large for 'long' type".

Example:
int main ()
{
long long int test = 0x0008888000000000;
},

解决方案
The warning message can be safely ignored, as mb-gcc is not doing anything wrong; the 64-bit computing is in fact correct.

This warning occurs because gcc is strict in syntax and requires LL on the end of such constants. This warning message disappears if the integer is appended with LL.

long long int test = 0x0008888000000000LL;

猜你喜欢

转载自blog.csdn.net/My__God/article/details/41824053