4 ms·
I don't know: debugging textual macro isn't fun but it isn't that hard either (provided you can convince your stupid build system to add a -E to your compiler f
by renox 6y ago
I don't know: debugging textual macro isn't fun but it isn't that hard either (provided you can convince your stupid build system to add a -E to your compiler flags), debugging AST macro sounds to me like debugging templates: a nightmare..
- qsort 6y agoIt'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.