Re:Nuklear: A single-header ANSI C GUI library
by chubot on Saturday February 10, 2018 @06:00PM
(#16350132)
Absolutely, great example! I have looked at quite a few implementations of preprocessors, and they're not simple.
I don't trust anyone who thinks it's simple without actually having implemented it -- and tested it on real code.
One older thread: https://news.ycombinator.com/item?id=10945552
Are you sure your implementation is correct? How does it handle this:
I'm not saying gcc's and clang's preprocessors are not really fast, but preprocessing is trickier than most people expect. In particular (as you can see from my example), while skipping over an "#if 0" you still have to split the source into tokens and discard the tokens.