long long problem

W

wolverine

Hi,
I compiled the following code

int main()
{
long long a = 0x7ff0000000000000L;
}


I got error "test.cpp:3: error: integer constant is too large for
"long" type". But i think that a long long variable can hold upto
(2^63-1) which is greater that 0x7ff0000000000000. Then why is the
error coming. The error comes only in g++ compiler and not in visual
studio. Could any one help me in this ?


Thanks in advance
Kiran.
 
A

aiooua

what you need is - long long a=0x7ff0000000000000LL;
seehttp://www-ccs.ucsd.edu/c/syntax.html#integer%20constantfor more.

and btw - "ISO C++ does not support `long long'".
dont count on that "LL" suffix to work everywhere.

thanks,
 
W

wolverine

and btw - "ISO C++ does not support `long long'".
dont count on that "LL" suffix to work everywhere.

thanks,

Thanks a lot. That piece of information helped.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,535
Members
45,007
Latest member
obedient dusk

Latest Threads

Top