On 06/22/2012 11:00 PM, Daniel Santos wrote: > Theory of Operation > =================== > Historically, genericity in C meant function pointers, the overhead of a > function call and the inability of the compiler to optimize code across > the function call boundary. GCC has been getting better and better at > optimization and determining when a value is a compile-time constant and > compiling it out. As of gcc 4.6, it has finally reached a point where > it's possible to have generic search & insert cores that optimize > exactly as well as if they were hand-coded. (see also gcc man page: > -findirect-inlining) For those of us who stopped upgrading gcc when it went to a non-open license, and the people trying to escape to llvm/pcc/open64/tcc/qcc/etc and build the kernel with that, this will simply be "less optimized" rather than "you're SOL, hail stallman"? > Layer 2: Type-Safety > -------------------- > In order to achieve type-safety of a generic interface in C, we must > delve deep into the darkened Swamps of The Preprocessor and confront the > Prince of Darkness himself: Big Ugly Macro. To be fair, there is an > alternative solution (discussed in History & Design Goals), the > so-called "x-macro" or "supermacro" where you #define some pre-processor > values and include an unguarded header file. With 17 parameters, I > choose this solution for its ease of use and brevity, but it's an area > worth debate. Because this is just _filling_ me with confidence about portability and c99 compliance. (Or I suppose C11!!one! compliance. The new thing that puts asserts in the base language and makes u8 a keyword since _that_ won't break existing code and putting utf8 string constants within quotes wasn't previously possible.) I'm not saying the standard's perfect, I'm saying a web page that ties itself to mozilla at the expense of working on firefox, let alone chrome, might be a bit short-sighted these days. XFree86 begat x.org, OpenOffice begat libre, etc. The FSF went nuts again and this time around EGCS is called LLVM, so talking about gcc 4.6-only features thrills some of us less than you might expect. I suppose sparse has to be able to cope with this, so that's something... > To avoid needing multiple versions of the macro, we use a paradigm Indeed. I still have trouble remembering how trampolines work when I wander away for a while. Oh well... Rob -- GNU/Linux isn't: Linux=GPLv2, GNU=GPLv3+, they can't share code. Either it's "mere aggregation", or a license violation. Pick one. -- To unsubscribe from this list: send the line "unsubscribe linux-doc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html