From: Bert Wesarg Date: Thu, 14 Jul 2011 19:07:54 GMT Subject: Re: [PATCH 1/3] implement generic key/value map Message-ID: In-Reply-To: <20110714185539.GA27141@sigill.intra.peff.net> On Thu, Jul 14, 2011 at 20:55, Jeff King wrote: > On Thu, Jul 14, 2011 at 08:54:07PM +0200, Bert Wesarg wrote: > >> On Thu, Jul 14, 2011 at 20:52, Bert Wesarg wrote: >> > On Thu, Jul 14, 2011 at 19:51, Jeff King wrote: >> >> +#define MAP_IMPLEMENT(name, ktype, vtype, cmp_fun, hash_fun) \ >> > >> > This define should probably in the header too. Else this is completely useless. >> >> Ahh. One have to read patch 2/3, to see how to use this. Please feel >> free to ignore this than. > > Yeah, you could treat this like a C++ template and assume random bits of > code will instantiate a map of whatever types they need. But this is C, > and we only want to instantiate once. So I just figured to keep the > static list of whatever maps git needs in the map.[ch] files. When I wrote such macros in the past, the 'generated' functions where all static. So one could instantiate a map multiple times in different compilation units where one need to access this type of map. But I'm perfectly fine with your way, which is new to me. Bert > > -Peff >