Re: Question about programming techniques

> well one problem is that templates basically generate source instead of
> being interpreted themselves ... so if you do a list of ints and a list
> of longs you suddenly have two implementations in the object file ...
> which is far from optimal ....

You're not being fair here. If you are happy with explicit casts (in
user code, rather than in the library) in a C container class library,
then you could just as well use a container of 'void *' with STL to
get the same effect.

If you _do_ want casts to happen in the library, you'll have code
dupication in the C implementation as well. And please note that the
STL specs say nothing about the internals of the library. It is
perfectly fine for an STL implementation to make all container types
share one 'void *' core, and only have a typesafe interface (I'm
simplifying here, but you get the point I hope).

As far as Mico is concerned: it's not just the templates that make the
thing big. The stubs are huge, and there are not many templates used
there. A 2Mb shared library is not such a big problem, it's the 
(non-shared) code in each application that makes things problematic.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]