Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cpp: eclipse doesn't recognize 'long long' type

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?

like image 255
kakush Avatar asked Jan 26 '12 08:01

kakush


1 Answers

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.

like image 120
Mysticial Avatar answered Sep 17 '22 19:09

Mysticial