3 ms·
Awesome stuff. It seems like a C+ instead of C++ to me. I wish it has class/object/ctor/dtor/RAII though, no need for exception. OOD in C using struct and func
by synergy20 4y ago
Awesome stuff. It seems like a C+ instead of C++ to me.
I wish it has class/object/ctor/dtor/RAII though, no need for exception. OOD in C using struct and function pointers are doable but is a bit cumbersome. I don't even need runtime overloading or virtual inheritance or any fancy/advanced features of c++, just a better way to organize code in an OOD style is enough, something like Javascript's class sugar syntax to its prototype object syntax(here will be c++ style to struct+function-pointer-style).
- lwswl 4y agomultiple function pointers in a struct is inefficient memory-wise, I think you'd be much better off with a single pointer to a lookup table that can be shared by all instances. Its even more cumbersome, but its what you pay if you want efficiency in c.