4 ms·
Fun fact: `typedef int I;` and `int typedef I;` are both valid and do the same thing.
by bla2 10y ago
Fun fact: `typedef int I;` and `int typedef I;` are both valid and do the same thing.
- bluetomcat 10y agoFor the curious on why this is: at the syntax level, typedef is treated like any other storage class specifier (static, extern, auto, register). So it is legal just like 'int static a' is legal.
- gsg 10y agoAnd if you want to go weirder, implicit int means that you can leave out the `int`: typedef x; Even "better", C declarators can be empty in order to allow for struct/enum declarations that do not list any variables. So you can leave out the variable, add qualifiers, etc: typedef; const typedef; typedef const; It's a really fun syntax in some ways.