What can I do (programmatically) to get rid of the warning?
...
unsigned long long v=(unsigned long long)0xffffeeeeddddcccc;
...
g++ main.cpp -o main
main.cpp:6: warning: integer constant is too large for ‘long’ type
but when I run the program everything is fine as expected:
./main
sizeof(unsigned long long)==8
value of v==0xffffeeeeddddcccc
used environment:
- Ubuntu-Karmic 32bit
- g++ version: v4.4.1
EDIT: here is the complete and compilable main.cpp
#include <iostream>
#include <iomanip>
using namespace std;
int main(void) {
unsigned long long v=(unsigned long long)0xffffeeeeddddcccc;
const unsigned v_size = sizeof(unsigned long long);
cout << "sizeof(unsigned long long)==" << v_size << endl;
cout << "value of v==0x" << setw(v_size) << setfill('0') << hex << v << endl;
return 0;
}