> Why? Because a language without macros is a tool: You write applications with it. A language with macros is building material: You shape it and grow it into your application.<p>Very nice! If only this could work with C++.
This is very interesting way to breathe new life into C. I can already think of few places where powerful macros would come in handy and eliminate some pains. On the other hand, I'm not sure if I'd want to read other people's low-level code sprinkled with high-level constructs. Perhaps Nim would serve this purpose better?
TIL: You can use typeof(expr) as a type in variable declarations. C has type inference! A plain old C macro like<p><pre><code> #define AUTO(var, expr) typeof(expr) var = expr
</code></pre>
might be handy sometimes.
This way of adding metaprogramming to C does not improve performance. The compiler will still be unable to inline the comparisons in the qsort example. C++ will continue to be much faster.