Comment by 0c3ca83

13 hours ago

Exactly. So if you're willing to accept that downside, C++ does a better job of letting you express that kind of cleverness.

I am not sure. I agree one should minimize macros in C, but for some things a small macro layer still beats the complexity of C++ and is not inferior in my opinion.

  • C++ templates are far cleaner, easier to debug, and produce more comprehensible errors than C macros. And C++ templates are rightly famous for being terrible at all of the above.

    • Hey, I agree about your second sentence but I do not really see the first. Alone that I can directly inspect the result of the preprocessor makes macros easier to debug than templates in my experience.

      4 replies →