3 ms·
> IMO the right way to have private members in C structs is... to document that members shouldn't be touched directly, perhaps using a special naming convention
by Joker_vD 3y ago
> IMO the right way to have private members in C structs is... to document that members shouldn't be touched directly, perhaps using a special naming convention or embedding the publicly-accessible members in a dedicated sub-struct to prevent confusion.
Reminds me of that one time when glibc broke the whole of Debian for s390 architecture by changing the fields in the jmp_buf struct (which is public): [0].
[0] https://lwn.net/Articles/605607/ https://lwn.net/Articles/605607/