3 ms·
Exactly. Don't do this. UB is fragile. When downshifting to C, use opaque structs to hide private data and use regular function pointers. There are numerous ex
by 1letterunixname 3y ago
Exactly. Don't do this. UB is fragile.
When downshifting to C, use opaque structs to hide private data and use regular function pointers. There are numerous examples of C VTables but these tend to be slow. When possible, don't use OOP or VTables because it's slow and more difficult to debug. Using plain functional and procedural architectures is much more robust, deterministic, testable, and easier to reason about.
https://godbolt.org/z/feajn1W4j https://godbolt.org/z/feajn1W4j