From: Andreas Ericsson Date: Sat, 01 Nov 2008 11:17:22 GMT Subject: Re: libgit2 - a true git library Message-ID: <490C3AC2.4080002@op5.se> In-Reply-To: <20081031220133.GA14786@spearce.org> Shawn O. Pearce wrote: > Andreas Ericsson wrote: >>> * proper public "stuff" naming (I e.g. realy like types names -- not >>> struct or enum tags, that I don't really care -- ending with _t as >>> it helps navigating source. >> *_t types are reserved by POSIX for future implementations, so that's >> a no-go (although I doubt POSIX will ever make types named git_*_t). > > Yikes. Anyone know where a concise list of the reserved names are? > The ones I know of off the top of my head are: * Anything ending with _t (posix) pthread_t, size_t, socklen_t, ... * str/mem/? function name prefix NOT followed by an underscore (C lib) strlen, strchr, memcmp, memcpy, ... (strbuf_ stuff doesn't break this, as it contains an underscore in the name - the underscore following it doesn't have to be immediate). * Double underscore prefix (compiler / C lib) __WORDSIZE, __cplusplus, ... It's also a good idea to stay away from single underscore prefix for generic-ish names, as some compilers/architectures abuse it extensively. Prefixing all public functions and macros of the library with 'git_' (lower-case for functions and function-like macros, upper-case for the rest) will probably see us through safe. Exceptions can probably be made for already completed API's, such as the arg-parsing stuff and the strbuf code. >> Apart from that, please consider reading Ulrich Drepper's musings on >> library design at http://people.redhat.com/drepper/goodpractice.pdf > > I think I've read that before, but I'll skim over it again. > Thanks for the link. > I swear by it at work, where I'm "the library guy". I'll make sure to review stuff and can chip in code or thoughts to make the library fly with a minimum amount of problems and maintenance burden. -- Andreas Ericsson andreas.ericsson@op5.se OP5 AB www.op5.se Tel: +46 8-230225 Fax: +46 8-230231