Reputation: 1095
Can you point me to a reference of design patterns in Standard C (C89 or C99)? (Not C#, not C++.)
Upvotes: 10
Views: 5780
Reputation: 4743
If you need information about real-time embedded C design patterns i can recommend the two books
Some of the higher-level patterns depend on an "emulation" of object-oriented features like mentioned before. The patterns are described very well (UML diagrams, examples). I like the discussions of the "forces" (What has to be considered?) which influence the context after applying the patterns.
Upvotes: 1
Reputation: 37159
Take a look at Axel-Tobias Schreiner's ebook Object-Oriented Programming with ANSI-C. You'll have to handroll some aspects of some patterns but you'll be able to implement many of the simpler GoF ones.
Upvotes: 14
Reputation: 56123
Following from Nick's answer, I suggest that you learn how to implement cplusplus-like things using C (e.g., a C struct with a pointer to a table of function pointers, emulates a C++ class with virtual functions), which means understanding how C++ is implemented by the compiler. Once you've done this then you'll be able to read design patterns for C++ and implement them using C.
Upvotes: 2
Reputation: 15484
Design patterns should be language agnostic - unfortunately most of them assume an object oriented environment.
Struggling with C coming from Object Oriented land?
Upvotes: 7