Reputation: 1398
Unlike other types:"int","boolean","double", etc. And even custom classes, there are one word only. There is only one word for their type, however, only that integer is using two words; how and why can it be that special?
Upvotes: 1
Views: 615
Reputation: 21
Actually, as I wrote in "The Long Road to 64-bits"
"Sometime around 1984, Amdahl UTS and Convex added long long for 64-bit integers, the former on a 32-bit architecture, the latter on a 64-bitter. UTS used this especially for long file pointers, one of the same motivations for long in PDP-11 Unix (1977). Algol 68 inspired long long in 1968, and it was also added to GNU C at some point. Many reviled this syntax, but at least it consumed no more reserved keywords."
I don't know offhand when GCC added long long, but since GCC 1.0 was released in 1987, these others were earlier.
Really, in practice this was decided de facto by the 1992 working grooup described in "The Long Road".
Upvotes: 2
Reputation: 1279
From: "The Long Road to 64 Bits" - by John R. Mashey | October 1, 2006 -Topic: System Evolution
"Algol 68 inspired long long in 1968, and it was also added to GNU C at some point."
Extract: Chronology: Multiple Interlocking Threads
End extract.
Note: Standard Algol68↗ does not have long char for unicode/UTF16, nor long long char, but (conveniently) the size of a char is not required to be the same size as that of a byte. Sometimes - "traditionally" - a char was less then 8-bits, e.g. 6-bits (ASCII or GOST) or 7-bits (eg ASCII and now GSM_03.38)
Upvotes: 3
Reputation: 76458
The reason that the C++ and C standards adopted long long
is that GCC had been using it for years, and, despite it's inherent ugliness, existing practice won out. As to why GCC chose that name, you'll have to ask them. <g>
.
Upvotes: 1
Reputation: 36118
The naming scheme for C types ultimately seems to inherit from good old Algol, which allowed arbitrary numbers of "short" or "long" prefixes before types like int
or real
(it's name for floats). Of course, their interpretation was implementation dependent, and there was no guarantee that long long long int
was actually any bigger than long int
.
C inherited the prefixes (for ints at least, strangely enough they chose something more adhoc for floats), but at the time did not see the need for allowing to iterate them. And because C was pretty lax in many respects, it also allowed to drop the int
itself in the case of long int
.
With the advent of 64 bit machines, the assumption that only few sizes, and thus a single prefix in this scheme, are needed broke, and compilers started supporting long long
. Part of the reason this scheme was rediscovered probably was that it did not require clobbering a new name or keyword. C99 then made this type official part of the standard, and C++ later inherited it.
Upvotes: 2
Reputation: 3216
long long
differentiates itself from long
, which is typically only 4 bytes (32 bits).
long
is a modifier, which can be used on many primitive types to modify them.
Upvotes: 0