I'm relearning C after not having touched it since 2000 or so. I've been working in Ruby since then, and I discovered a whole world of programming idioms I never knew existed.
What important C techniques, books, idioms, etc. have arisen in the past decade, if any? I know about the C99 and C11 standards, but where else should I be looking? Or has C style remained constant even as OOP and FP have become the norm?
C doesn't support at language level nothing more than procedural programming - and that's a precise choice, because it was born to be mostly a "portable assembly" and it's used to work as tightly close to the machine as possible (without resorting to assembly). Most assembly languages do not provide much more, in terms of programming paradigms, than a stack and function call statement (some micros not even that) - and that's what C is modeled upon.
After all, there's a reason why C++ and Objective C were born: C has to keep its design philosophy, and to add more abstract stuff people had to actually fork the language.
That being said, there's nothing stopping you to write e.g. OO code in C - actually, many people do that (I'd say that it's one of the most diffused idioms in C), but you don't have to expect almost any syntax sugar for that: you'll have to use struct
s for the data, "normal" functions to "emulate" methods, composition for inheritance, pointer tables for polymorphism, and so on. Still, I don't know if this counts as a "last decade" idiom, it is being used since much longer.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With