I know the title seems quite stupid, but I think it's worth asking.
Take this declaration(or definition, maybe) for example:
_Thread_local long volatile static int _Atomic const long unsigned x = 10;
I used to consider long long
as a type, but if it's a type name, how can so many qualifiers be inserted into it?
So I consulted N1570 with this question, only to be more confused. It mentions some terms such as "type-specifier" and "type-qualifier", and I can't find long long
in "type specifiers", but isn't long long
a primitive type in C? There are so many books telling me so!
Clarifying not duplicate:
Yes, I saw an existing question deals with long int long
, but this question have something to do with qualifiers, and is in C.
If you read the right bits of the standard carefully enough, you find that the monster declaration in the question is valid, even if implausible.
The 'right bits' includes:
Other declaration specifiers include storage classes (
static
and_Thread_local
in the example), and type qualifiers (volatile
and_Atomic
).Also, as noted by Olaf in a comment:
It is also eccentric to split up the integer type keywords (the type specifier). A more orthodox version of the declaration would be:
(or it might drop the
int
).