Jean-pierre Martineau wrote:
how apply design patterns to c ?
Design patterns aren't tied to any particular implementation. Many of
the well-known design patterns (consider for example Visitor and
Factory Method) are however not meaningful in a C context; the problems
they solve simply doesn't exist in C.
That said, it is my belief that C programmers can benefit from the
growing catalogue of patterns and I have written an article series
about patterns in C.
My pattern implementations are not be based on techniques for emulating
object oriented features such as inheritance or C++ virtual functions.
In my experience, these features are better left to a compiler;
manually emulating such techniques are obfuscating at best and a source
of hard to track down bugs at worst. Instead, it is my intent to
present implementations that utilizes the strengths of the abstraction
mechanisms already included in the C language
For more details, you can read the series at
http://www.adampetersen.se/
Regards, Adam