4 ms·
Why is "idiomatic C" equivalent to "long functions and few internal interfaces"? The whole point of having a small surface-area for your ABI with plenty of det
by sfpotter 4y ago
Why is "idiomatic C" equivalent to "long functions and few internal interfaces"?
The whole point of having a small surface-area for your ABI with plenty of detail hiding is that you are free to do what you like beneath it. If the code uses a struct named "hash_map" that takes a generic hash function and stores void pointers, but runs fast for my purposes, what do I care? These techniques give you a controlled way to build black boxes.
C is a very flexible language, and it is possible to build up quite a variety of patterns in it. Your job as an engineer is to look in your toolbox and select the best tool for the job. Adhering to a "correct idiom" gets in the way of this.