This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

guidelines for code reuse vs. one-function-per-file?


I'd like to know what the guidelines are around the
one-function-per-file rule / preference.  I'm looking at rwlock, and the
various functions there (e.g., trywrlock, wrlock, timedwrlock) are all
just variations of the same thing.  If we keep each function in its own
file, there's going to be code duplication, and it won't help with
maintainability.  I suppose the one-function-per-file rule is for
reducing size when linking statically, so what is one allowed to do to
avoid code duplication?

* Can one put related functions into one file?  For example:
  * Put trywrlock, wrlock, timedwrlock into one file?
  * Put all rdlock/wrlock functions and unlock into one file?
* Can one use a source file (or header?) containing all the code and
include it in all the per-function files, using always_inline etc.?


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]