Structs interface and Hiding members in a C struct discusses various ways in accessing /modifying members.
What would be pros/cons of using:
- Opaque handle to struct and setters/getters
- Accessing members directly
- foo.value(&foo, value) functions (like C++ class methods)
- Separate header files for same struct exposing public members for client and all members internally
In my case, I'm doing OOP in C and all my structs hold a list of properties (id, name, desc, ...). I need to track changes so that changed status could be transmitted over network. The best way, as I see it, would be to transmit the delta (changes between individual members) and not retransmitting the whole struct.
Thank you