Eric said:
I'm surprised you got any output at all, because neither
`double int' nor `int double' is a valid type name. You
should have received error messages from the compiler.
Not in C, but your compiler seems to be processing some
other language.
It appears to be pseudo legal in <unnamed compiler>.
In case OP is using said compiler, here are some quick observations --
(1) if `signed' and `unsigned' appear in the same declaration, only
the last one specified affects signedness.
[Based on earlier observations, <unnamed compiler> accepts
`signed main()' but rejects `unsigned main()'. Tests show that
`unsigned signed main()' is accepted but `signed unsigned main()'
is not, from that we can conclude that later modifiers affecting
signedness probably overrule earlier ones.]
(2) if more than one base type appears in a declaration, sometimes,
later conflicting types overrule earlier ones.
[The test method here uses the fact that doing something illegal
(assignment to object of incompatible type) produces a diagnostic
that reveals the actual type of the created object. Consider this
code snippet
void *foo;
double int bar; /* line 5 */
int double baz; /* line 6 */
foo = bar; /* line 7 */
foo = baz; /* line 8 */
5: W: multiple use of 'int'
6: W: multiple use of 'double'
7: E: operands of = have illegal types 'pointer to void' and 'int'
8: E: operands of = have illegal types 'pointer to void' and 'double'
From that we can conclude that `bar' probably has type `int' and
`baz' probaby has type `double'.
Using the same procedure it turns out that `long long double' is
seen as plain `double', but `long double int' is `long int'.
`long short' is `short' and `short long' is `long', `long short long'
is `long' and `short long short' is `short' -- the same rules
affecting signedness discovered in (1) probably also apply when
deciding short or longness.
There is, however, a small inconsistency in that `short short short'
is probably `short' but `long long long' is in category (3)]
(3) other combinations are flagged as errors and compilation stops --
[Same method used as before
void *foo;
unsigned double bar; /* line 5 */
double unsigned baz; /* line 6 */
foo = bar; /* line 7 */
foo = baz; /* line 8 */
5: E: invalid type specification
6: E: invalid type specification
In conclusion, <unnamed compiler> treats some illegal combinations
of types/types and types/modifiers as errors, others merely as
warnings; but they are warned about even without any flags
requesting extra warnings and <unnamed compiler> appears to be
conforming in these regards.
Answering the original question, `double int' is not a valid
type, but some implementations, in certain cases, appear to pick
one type if more than one is given. In <unnamed compiler>,
`double int' is seen as `int',
and
`int double' is seen as `double',
in both cases after issuing the required diagnostic (warning).