long long

Patrick Pelissier patrick.pelissier at gmail.com
Tue Jul 31 18:47:22 CEST 2012


>> Why not intmax_t / uintmax_t instead of long long / unsigned long long?
> I believe every platform that has intmax_t also has long long, but the
> converse is not true.

 Do you have an example of such a platform?

> Some platforms provide types larger that intmax_t (intmax_t is part of the
> ABI, and they couldn't change it when they added a longer type, see for
> instance __int128 in gcc).

 Well according to PR#49595, __int128 is not even an extended integer
type but something strange which can hold an integer of 128 bits.
Since the C standard doesn't apply (since it is not an extended nor
standard integer tyoe) and since GCC Manual doesn't specify what
operations are valid and what are not, I am not even sure what a+b
does when a and b are __int128 :)

> intmax_t started from a good intention, but it seems fairly useless in
> practice.

 I rarely used long long but used intmax_t  quite often. I found "long
long" quite useless: either you need 64 bits arithmetic, and you
should use int64_t (or its friends) to have the optimal type, or you
need the type which can fit them all, and you should use intmax_t.

--
 Patrick


More information about the gmp-devel mailing list