3 ms·
You can write object-oriented code in C, but no matter what tricks you do with storing function pointers in structs, you still have to pass the struct itself as
by williamcotton 3y ago
You can write object-oriented code in C, but no matter what tricks you do with storing function pointers in structs, you still have to pass the struct itself as an explicit argument.
A sprinkle of clang blocks and Block_copy on top of your structs and you’re on your way!
- Inviz 3y agoIs there something like that in gcc?
- williamcotton 3y agoThere is not! There are those nested functions but they’re missing the ability to close over state and store it on the heap.