Is “long long” = “long long int” = “long int long” = “int long long”?

According to the C++ Standard (7.1.6.2 Simple type specifiers)

3 When multiple simple-type-specifiers are allowed, they can be freely
intermixed with other decl-specifiers in any order.

So for example the following declaration is valid

long static long const int x = 10;

You may even use constexpr specifier along with const qualifier. For example

constexpr long static long const int x = 10;

By the way, we forgot about specifier signed! Let’s add it for example before declarator x

constexpr long static long const int signed x = 10;

In C you may also use several type qualifiers in the same declare specifier sequence. According to the C Standard (6.7.3 Type qualifiers)

5 If the same qualifier appears more than once in the same
specifier-qualifier-list, either directly or via one or more typedefs,
the behavior is the same as if it appeared only once….

So for example in C the following declaration is also valid

const long const long static const int const signed x = 10;

So if you are paid according to the number of symbols typed in the program then I advise you to use such declarations. 🙂

Leave a Comment