Very nice! If only this could work with C++.
Write-only languages, yay.
#define AUTO(var, expr) typeof(expr) var = expr
This is only one-way type deduction (similar to C++ `auto` keyword) which isn't really proper two-way type inference. It just copies the type of the right hand side to the left hand side.
E.g. given the following code:
x = less_than(a, b) ? (a+1) : b;
And by "proper type inference" I mean the text book Hindley-Milner unification algorithm from the 1970's, not a more modern variant with traits or type classes and whatnot.
Or correctly; it is so common and so different (and incomplete) across implementations, so a new name with the exact semantics has been invented .
Now a type deduction operator is never going to come to standard C because any proposal will get buried under endless bikeshedding about whether to call it `typeof()` or `decltype()`.
This is why, for example, the language-level boolean type introduced in C99 is `_Bool`, and then you can include a standard header that will typedef it to `bool`. Identifiers that begin with an underscore and an uppercase letter are reserved for the implementation, so no compliant code will be using _Bool anywhere for itself. And since old code won't include `stdbool.h`, there's no conflict if it happens to define its own `bool`.
Given this, it seems like the best approach would be to call it `_Typeof` or similar, with a standard header that does `#define typeof(x) _Typeof(x)` to make it nicer to use.