Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
What’s the Point of the C Preprocessor, Actually? (hirrolot.github.io)
2 points by signa11 on Aug 3, 2021 | hide | past | favorite | 3 comments


It's been 2 decades since I last programmed in C. But all I remember of Macros is that some of the most difficult bugs to spot in C code lives in Macros. A missing paranthesis, unthoughtful coding can make it extremely difficult to spot the bug. Also makes code unreadable...Check out Linux source...


I have a rule that macros are always generated by a perl script. The macro syntax is too easy to mess up. Also generating it in a higher-level language makes it easier to comprehend.


Perl? Well you need a time machine just to reach the present... :) Anyway, that setup sounds too complex...Perl generated macros further expanded by the preprocessor... A bug in that tool path can be the most hard to detect... Good luck!!!




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: