5 ms·
Compilation speed and incomprehensible compiler errors remain an issues for template heavy code but this is the first time I've heard complaints about binary si
by kingkongrevenge 17y ago
Compilation speed and incomprehensible compiler errors remain an issues for template heavy code but this is the first time I've heard complaints about binary size. Can you educate?
Theoretically the incomprehensible compiler errors will go away in the next couple years as compiler writers integrate C++0x "concepts."
- wheels 17y agoEvery specialization of a template creates a new instance of it with new symbols. With heavily nested templating that can add up quite quickly. The most problematic case at my last company was where there were several hundred specializations (just one-liners) one after another in some of the error handling code. Each of those specialized several more templates. I managed to shave a few dozen MB off of the binary size (and remember, larger binaries == more cache pressure) by replacing the templates with a base class and virtual function.