4 ms·
Although calling the preprocessor "functional" is being too pleasant. The C preprocessor was always a text substitution system, so macro as parameter is not th
by bsder 7y ago
Although calling the preprocessor "functional" is being too pleasant. The C preprocessor was always a text substitution system, so macro as parameter is not that "obscure". Of course, I may have missed something subtle in the example.
It's also not clear how to use that preprocessor example.
- elteto 7y agoIt can be very useful! I added a small comment with an example of how I used it once.
- augusto-moura 7y agosee http://conal.net/blog/posts/the-c-language-is-purely-functional http://conal.net/blog/posts/the-c-language-is-purely-functio... old but gold
- juped 7y ago>The C ADT is implemented simply as String (or char *, for you type theorists, using a notation from Kleene) Still makes me laugh
- multun 7y agoIt is never obscure when you know it. And sure, it was always meant that way. It's just rarely used this way, which is why it's in this list. Here's what the example yields once preprocessed: struct operator{ int priority; const char *value; }; struct operator operator_negate = { .priority = 20, .value = "!", }; struct operator operator_different = { .priority = 70, .value = "!=", }; struct operator operator_mod = { .priority = 30, .value = "%", };