Re: Friday afternoon C trivia:



Stefan Reuther wrote:
So far, all schemes of template management I've encountered had their
drawbacks in practice.

I don't doubt that, and I symphatize with your descriptions
of interaction between templates and the compiler.

Templates are instantiated to generate code. Unless you're using
templates that are completely inlined and optimized away (which is
indeed useful, and which I use all the time), of course it affects the
binary size.

Sure, but if you don't get the code from template instantiation,
then you need to get it from somewhere else, e.g. write it by hand.
If the template instantiation and the hand written code are equivalent,
then I would hope the resulting binaries to be equivalent. Otherwise
it would be time to change the compiler vendor ;-)

Some people (not you obviously) seem to think that there is some
intrinsic run time overhead using templates. But templates -- and
metaprogramming in a more general sense -- are really compile time
phenomena. Hence my comments.
--
Pertti
.


Quantcast