Re:Comparing the Cost of Different Multiple-return Technique...
by yoklov on Tuesday December 24, 2013 @12:50AM
(#6958423)
You basically split it up in a similar way that you'd use in an OO language, except you don't have inheritance and only have composition. Specifically, you break apart the logically distinct portions of your structs and you make them structs themselves. E.g. compare (trivial examples, but you get the idea).
This also allows a form of inheritance. For example if you have
Those are the ways I tend to break up structs when writing C code. Basically by using lots of composition.
[ Parent
| on HN ]
Re:Comparing the Cost of Different Multiple-return Technique...
by acqq on Tuesday December 24, 2013 @04:20AM
(#6958826)
And the good aspect of C is the "flatness" of the structures: they are not "objects" with the hidden content and associated functions managing it. It's a way for the programmer to organize the data as efficiently as possible.