+ 6
long long long
Why is long long long too long for GCC?
5 Respostas
+ 8
You can try reading this paper. A proposal of 'long long' being added to C++. 'long long long' is not defined, and perhaps one of the reasons were listed in the paper. 'long long' was already considered an ugly name for 64-bit int, let alone 'long long long' for 128-bit int.
https://www.google.com/url?sa=t&source=web&rct=j&url=http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2005/n1811.pdf
If you need / just want to use 128-bit int, perhaps looking into __int128_t (or __uint128_t, __int128, etc) would help (Take note that these are extensions provided by compilers, and not standard).
If it's too much of a fuss, just grab a bignum library. :x
https://gmplib.org
+ 4
https://sourceforge.net/p/mingw-w64/mailman/message/28855308
"Somebody had #define intmax_t long long, likewise for uintmax_t.
Btw, why are you building bash for win64? How does that even work?"
In that thread the error message from gcc appears to be related to Cygwin or MinGW;
I just skimmed because: needs more context? I have both environments and could try
duplicating this if you told us what you were doing to get that message.
+ 3
Moses Odhiambo My apologies if I'm distracting from Hatsy Rei's answer, please don't worry about me here :)
Hatsy Rei Ah, indeed it is. In response, I tried to create this as a little joke:
#define a long;
long a longlong;
...but it didn't work so I tried this, which mysteriously worked (giving the "too long" error, when actually I'm doing this wrong)
#define a long long;
At first, I thought the preprocessor was being dumb, and then I tried:
typedef long a; // also: long long a
...which properly does not accept this definition form (in either case; no "too long" error), restoring my faith in the preprocessor:
long a longlong; // acceptable: a longlong;
It looks like the #define weirdness is an edge case and your assessment (the obvious case) makes more sense.
Apologies for the distraction ~
+ 2
first time I used long long I didn't know about it, I just tried and it worked. So it may look ugly to some, but it was intuitive for me.
+ 2
Kirk Schafer If I'm not mistaken, he was trying to declare a variable of type long long long, e.g.
long long long int num;
It appears to be reproducible using Code Playground.