This is specified in the C Standard (N1570 draft), section 6.7.2.
A type-specifier is any of several keywords and other constructs, including float
, long
, double
, and _Complex
. Paragraph 2 says (emphasis added)
At least one type specifier shall be given in the declaration
specifiers in each declaration, and in the specifier-qualifier list in
each struct declaration and type name. Each list of type specifiers
shall be one of the following multisets (delimited by commas, when
there is more than one multiset per item); the type specifiers may
occur in any order, possibly intermixed with the other declaration
specifiers.
And in paragraph 5:
Each of the comma-separated multisets designates the same type, except that [irrelevant exception omitted].
The listed multisets include:
float _Complex
double _Complex
long double _Complex
Which means that, for example, long double _Complex
and _Complex double long
are both equally valid, and have the same meaning.
(The standard uses the slightly obscure term "multiset" because the number of times a type specifier occurs can be meaningful. If not for long long
, it would have used the word "set".)
And the <complex.h>
standard header defines the macro complex
, which expands to the keyword _Complex
.
I know of no C compiler that supports _Complex
but doesn't permit type specifiers to be in any order. If you find one, submit a bug report.
Having said that, there's no point in arbitrarily reordering type specifiers. double complex
is the most idiomatic form (which of course requires #include <complex.h>
). Though the syntax doesn't treat them that way, you can think of double
as an adjective and complex
as a noun; double complex
is a complex type, not a double type.