What does LL mean?

Luchian Grigore picture Luchian Grigore · Mar 22, 2013 · Viewed 26.7k times · Source

Is LL defined anywhere in the standard (hard term to come by)?

ideone accepts the code

int main()
{
    std::cout << sizeof(0LL) << std::endl;
    std::cout << sizeof(0);
}

and prints

8
4

But what does it mean?

Answer

Andy Prowl picture Andy Prowl · Mar 22, 2013

It is specified in Paragraph 2.14.2 of the C++11 Standard:

2.14.2 Integer literals

[...]

long-long-suffix: one of

ll LL

Paragraph 2.14.2/2, and in particular Table 6, goes on specifying the meaning of the suffix for decimal, octal, and hexadecimal constants, and the types they are given.

Since 0 is an octal literal, the type of 0LL is long long int:

#include <type_traits>

int main()
{
    // Won't fire
    static_assert(std::is_same<decltype(0LL), long long int>::value, "Ouch!");
}