Reference to Design Patterns in ANSI C?

Reference to Design Patterns in ANSI C?

Can you point me to a reference of design patterns in Standard C (C89 or C99)? (Not C#, not C++.)

Consider a “disposable” keyword in C#


Refactoring Form to State Pattern?
Take a look at Axel-Tobias Schreiner's ebook Object-Oriented Programming with ANSI-C.

Provider Pattern & DefaultProvider
You'll have to handroll some aspects of some patterns but you'll be able to implement many of the simpler GoF ones..
Recursive Class Design Patterns: Options and Best Practices

Sample WPF apps for line of business apps?

Is a switch statement applicable in a factory method? c#


Suitable Design Pattern for a Simple Chat Application
Design patterns should be language agnostic - unfortunately most of them assume an object oriented environment..
Useful software design patterns in .NET


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..


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..

88 out of 100 based on 48 user ratings 1198 reviews