[LC++]Generic programming vs OO inheritance

Kai Vehmanen kaiv at wakkanet.fi
Wed Aug 22 02:12:05 UTC 2001


On Mon, 20 Aug 2001, Jack Lloyd wrote:

>> My biggest grief with gcc C++ templates is the lack of support for export.
> Nobody supports export. I actually belive that to be a literal statement;
> absolutely no existing compiler from any vendor supports export. If there
> is one, let me know, I'm curious who will have it first.

That's true I guess. I just checked KAI C++'s web page, and yup, export is
still on the unimplemented features list (
http://www.kai.com/C_plus_plus/v4.0/doc/standard.html#CppDeficiencies ).
Are there any other C++ compilers like KAI which specifically aim to be as
std-C++ compliant as possible...?

In any case, support for export would be a great addition.

>> that a small change to the implementation of some template class routine
>> implementation results in recompilation of practically the whole system.
> A nice workaround, and makes things easier when compilers do have export:
[...]
>   1) Cut out all the 'real' code (code that would go in a source file if it
> could).
[...]
>   2) Put it into another file (I call them .icc, for included CC, but
> whatever works for you)

I've done this, but it doesn't help if you have automatic dependency
tracking. I use standard automake/autoconf/libtool setup for my Linux C++
projects, and the template definition files end up in the dependency
chain... (as they should, if you include something, it's a dependency).

And as compiling big C++ programs is already painfully slow, we really
don't need the extra overhead caused by going through template
definitions.

Has anyone got any good workarounds for autoconf/automake environment?  
With a good solution to this, I think I would be using templates much more
in my C++ code. As it is now, I use templates only when absolutely
necessary.

One thing I haven't tried yet is gcc's '-fexternal-templates' switch. At
least in the past, there were some troubles with this if you also used STL
(as most of us probably do), but I don't know about the current state
(especially with gcc 2.95.x and the new 3.x). Anyone here using this?

-- 
 http://www.eca.cx
 Audio software for Linux!




More information about the tuxCPProgramming mailing list