Hacker News new | ask | show | jobs
by yudlejoza 1931 days ago
I'm a big fan of C but, to be fair, your example makes border-line abuse of the macro system. In my opinion, the example doesn't show that C language per se (without the preprocessor part) is capable of higher-order functions (but as others have pointed out, it is, in the form of function pointers).
1 comments

The preprocessor is part of the language. Also there is no really such a thing as "abuse" of the macro system, this is taking advantage of a language facility to do something one wants. It is like saying someone abuses the type system when they define a handle type or abusing the namespace system when they define a static variable.

C's preprocessor is very powerful and like the rest of the language it can be used to shoot yourself in the foot - but that doesn't mean you shouldn't take full advantage of it or that actually taking advantage of it instead of treating it as a poor man's module system is "abusing" it.