[Web Feed] Objects are not a native concept in C, but you can achieve something resembli...

Feed Supplier <[email protected]> Wed, 12 May 21 05:50:32 UTC
Newsgroups alt.comp.programming
Organization Usenet.Farm
Message-ID <[email protected]>
..ng objects by using a design pattern known as the “opaque poi



Objects are not a native concept in C, but you can achieve something resembling objects by using a design pattern known as the “opaque pointer”. This post will show you what the pattern is, explain some of the finer details, and provide guidance on when you should and shouldn’t use it.

The opaque pointer is one of the most useful and frequently-encountered design patterns in C. Even if you are a die-hard C++ proponent (or _gasp_ Rust!), the reality is that there are, and will continue to be, a lot of embedded projects out there written in C. And you may need to contribute to one of them.




Link 1


Practical Design Patterns: Opaque Pointers and Objects in C: https://interrupt.memfault.com/blog/opaque-pointers