On Thu, Jul 14, 2011 at 09:07:54PM +0200, Bert Wesarg wrote:
quoted
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.
Yeah, that would work. It can bloat the code more, but in practice, not
much. It would also work better if we were providing the map API as a
library to arbitrary code. But we have the luxury of knowing all of the
types that will be used with it at compile time. :)
-Peff