Can you point me to a reference of design patterns in Standard C (C89 or C99)? (Not C#, not C++.)
4 Answers
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.

- 36,220
- 13
- 81
- 146
Design patterns should be language agnostic - unfortunately most of them assume an object oriented environment.

- 1
- 1

- 15,244
- 11
- 66
- 92
-
1Design patterns are sold as something that should be language agnostic. As universally applicable models, when in fact they are conventions spawned by the programming models that are in vogue. They're perfectly fine for what they are, but they've been sold as something they're not. – Michiel Buddingh Jun 19 '09 at 20:51
-
They are language agnostic, but not always paradigm agnostic. – dukeofgaming Mar 03 '12 at 22:46
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.

- 54,973
- 13
- 116
- 224
If you need information about real-time embedded C design patterns i can recommend the two books
- "Real-Time Design Patterns: Robust Scalable Architecture for Real-Time Systems" (Douglass, Bruce Powel | Elsevier | 1th Edition | 2002) and
- "Design Patterns for Embedded Systems in C: An Embedded Software Engineering Toolkit" (Douglass, Bruce Powel | Elsevier | 1th Edition | 2011)
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.

- 4,193
- 2
- 40
- 76