2 ms·
It's true that going down the macro rabbit hole is hardly ever a win, no matter how you handle it. But I don't buy that textual macros are really any better. Fo
by qsort 6y ago
It's true that going down the macro rabbit hole is hardly ever a win, no matter how you handle it. But I don't buy that textual macros are really any better. For starters, they are impossible to reason about, because they can always involve action at a distance. Also you are completely giving up whatever type safety you have (which is admittedly not much in pure C, but better than nothing), and because cpp has no notion of what valid C looks like, your program could even compile without even printing a warning if you write a macro that's wrong just in the right way.
There are cases where a simple textual macro is fine, and that's what the designers probably envisioned. But it's a slippery slope: because the macro system is there, it will be used, and because it will be used, it will shape how the language looks around itself.