I have some where in my code the next line: long long maxCPUTime=4294967296;
(the largest number long type can be is 4294967296 -1 , so I used long long)
the problem is, when I compile ,I get the next error:
error: integer constant is too large for ‘long’ type
Its as if, eclips doesn't recognize that I wrote 'long long' and it thinks I wrote 'long'.
(I'm using linux os)
anyone knows why I get this error?
Append LL
to it:
long long maxCPUTime = 4294967296LL;
That should solve the problem. (LL
is preferred over ll
as it's easier to distinguish.)
long long
wasn't officially added to the standard until C99/C++11.
Normally, integer literals will have the minimum type to hold it. But prior to C99/C++11, long long
didn't "exist" in the standard. (but most compilers had it as an extension) So therefore (under some compilers) integer literals larger than long
don't get the long long
type.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With