History of "Long Long"

I've only been using this site for a short time, but I'm already a huge fan. One of the features of this site I like, is that there is attribution about when a feature was added to the language by being flagged as C++11, C++14, etc.

I have recently been looking through Bjarne Stroustrup's "C++ Programming Language 3rd Edition" published in 1999. I noticed in this edition that there is no reference to "Long Long", or the "LL" constant suffix modifier. This site correctly lists these types--(for example on the http://www.cplusplus.com/doc/tutorial/constants/) page but does not give any attribution about when they were added to the language, which presumably happened after the 1998 version. It would be nice if it could be noted when these changes were added. Thoughts?

That is one thing I have always liked about this site as well. Cppreference has been doing the same for a little while as well, now. Both sites fall short of a more complete history of language features.

But to be fair, neither site professes to have that kind of information.

“Long long” was officially introduced by C++11. It has long before been a compiler extension on various systems.
adam720
Although it is interesting to know that, can you tell me why it is useful ?
It would be nice if it could be noted when these changes were added. Thoughts?

long long is a core language feature. cplusplus.com/reference is only a standard library reference. cppreference.com has both; and mentions that
1. long long is "since C++11" in http://en.cppreference.com/w/cpp/language/types#Integer_types
2. long long is "since C99" in http://en.cppreference.com/w/c/language/arithmetic_types#Integer_types

so there is your history: C got it first, in 1999, then C++ picked it up in its next major revision, in 2011.

If you want to go deeper, see ANSI C Rationale, which describes how C added long long in several lengthy paragraphs beginning with "C99 adds a new integer data type, long long,", pages 37-41 of http://www.open-std.org/jtc1/sc22/wg14/www/docs/C99RationaleV5.10.pdf
Last edited on
closed account (E0p9LyTq)
why it is useful?

A long can hold over 4 billion different values, a long long can hold over 18 billion values.

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <iostream>
#include <limits>

int main()
{
   using UINT = unsigned int;
   using ULNG = unsigned long;
   using ULLG = unsigned long long;

   std::cout << sizeof(UINT) << '\t' << std::numeric_limits<UINT>::max() << '\n';
   std::cout << sizeof(ULNG) << '\t' << std::numeric_limits<ULNG>::max() << '\n';
   std::cout << sizeof(ULLG) << '\t' << std::numeric_limits<ULLG>::max() << '\n';
}
@FurryGuy
Methinks you missed punksheep's intent: he wishes to know why the date of an added feature is useful.

The reason is that sometimes (often, even) you have to deal with legacy systems, and knowing when a feature was implemented by not just the standard but by specific compilers is necessary.

Hope this helps.
Topic archived. No new replies allowed.