I occasionally use 64 bit arithmetic in an open source C++ library of mine. I discovered that long long
serves my purpose quite nicely. Even some 10 year old solari
You can also suppress the warning using gcc's "__extension__" feature, e.g.:
// No '-pedantic' warning/error.
__extension__ long long foo = 2;
// Exhibits '-pedantic' warning/error.
long long bar = 3
and the compile:
$ g++ -pedantic -fsyntax-only foo.cpp
foo.cpp:5: error: ISO C++ 1998 does not support 'long long'
Notice that only the last use of long long
triggered the -pedantic
error since no __extension__
was prepended. Regardless, I'd go with @Steve Jessop's suggestion of using int64_t
instead.