Re: Is export "useless and broken"?

kanze_at_gabi-soft.fr
Date: 09/08/04


Date: 8 Sep 2004 15:18:19 -0400

Francis Glassborow <francis@robinton.demon.co.uk> wrote in message
news:<IHjtv$SYrFOBFw+d@robinton.demon.co.uk>...
> In article <d6652001.0409020233.fca3506@posting.google.com>,
> kanze@gabi-soft.fr writes
> >Because make sees the dozen or so object files as being dependent on
> >the template header file. If modifying the implementation of the
> >template updates the timestamp of the header, make will recompile all
> >of these files. In the case of export, the modification is in an
> >implementation file, the "dependency" is handled by the pre-linker,
> >which knows enough to only compile one of the source files which
> >triggered the instantiation, and not all of them.

> True, but only relevant if the header file with the template in it is
> not yet stable. I doubt that this is true for many uses of templates
> in large scale applications.

It's obviously not true -- in a large scale application, you avoid
templates other than very simple or very standard things (like
std::vector), because you can't afford the dependencies.

But that's circular reasoning: we don't fix the problem, because the
case in question doesn't occur in real code, and the reason it doesn't
occur in real code is because the problem isn't fixed.

I don't know how relevant templates at the application level will be in
the future. Today, they aren't used, because of the dependencies they
introduce. And we do get by without them. However, in an earlier time,
we got by without templates at all, and when I see some of the work of
Andrei and others, I see things which might be relevant in application
level code, if not now, then in the future.

FWIW: I actually had the problem once. It turned out that one of the
"stable" functions was a real performance bottleneck, and had to be
tuned. Tuned, by experimenting with different variations, and running
the results through the profiler. The actual function was called from
exactly one module in the program, but the template was used in about
20. And each time I modified the template, make recompiled all 20
modules. I'll admit that it is an extreme case, but it did actually
occur.

--
James Kanze           GABI Software         http://www.gabi-soft.fr
Conseils en informatique orientée objet/
                   Beratung in objektorientierter Datenverarbeitung
9 place Sémard, 78210 St.-Cyr-l'École, France, +33 (0)1 30 23 00 34
      [ See http://www.gotw.ca/resources/clcm.htm for info about ]
      [ comp.lang.c++.moderated.    First time posters: Do this! ]


Relevant Pages