This is my series of posts on C. The aim is to document techniques for writing medium- to high-level programs. Modern C programming has moved away from the focus in absolute efficiency, and there are many large programs solving problems where abstraction is necessary. Efficiency is still important; but it’s often satisfactory to run 20% slower if it means the code is easier to maintain!
As I write posts I’ll add them to this brief table of contents. You can also see a list of the posts in the category.
Note that I do not get a lot of feedback before posting. I would be interested in any criticism, and am happy to expand a post if a reader suggests it; or to correct a post where an error is pointed out to me. :-)
- The initial post on Higher-level C in which I lament the scarcity of C programming books.
Objects in C
- The basic technique of using a struct to create a user-defined type (a class).
- How to encapsulate methods with data.
- And how to use method polymorphism using function pointers.
- Simulating namespaces with structs.
Memory Management: malloc/free; Problem of computing optimal destruction of object; Pools; GC, E.g. Beohm; Pre-allocated and stack-based memory
Data structures: Strings; Collections; Generic data structures; Type safety; polymorphism.
Classes: Common base object; Interfaces; Multiple-inheritance (possible?); Multiple-interface implementation (possible?)
Functional programming: Laziness; Closures; Callbacks
Introspection and reflection: E.g. Printing an object
Exception handling: setjmp/longjmp; Exception as return value; Macro misuse
Code organisation: Dependency Injection