3 ms·
> Even if you had a gigabyte of text in an #if 0, that's only about 2 more seconds on the compile Are you sure your implementation is correct? How does it hand
by moefh 9y ago
> Even if you had a gigabyte of text in an #if 0, that's only about 2 more seconds on the compile
Are you sure your implementation is correct? How does it handle this:
#if 0
"\
#endif \
"
#endif
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.
- chubot 9y agoAbsolutely, 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 https://news.ycombinator.com/item?id=10945552
- a_t48 9y agoI agree with the sentiment, but it should be easy enough to smash line continuations together while you're searching for that #endif (famous last words)