C language is old, actually, a very old language that resisted all the innovations that impacted the software development industries. Even ISO standard Cobol integrated object-oriented capabilities in 2002!
This didn’t prevent programmers from applying object-oriented programming to C. With some macro juggling and a lot of self-control not to break framework rules, you can have inheritance and dynamic dispatching.
Generic programming is, in the same way, foreign to C language1. You can use preprocessor macros to implement generic containers or functions that can be instantiated on the type you need, but it is a painful endeavor.
Continue reading “Fun with Functors in C”