Mail Archives: djgpp/1997/05/15/18:49:03
Robin DOT Paterson AT dundee DOT ncr DOT com DOT org writes:
> If you've got a g++ with the repo patch, _then_ it
> will work like the Sun compiler, or the NCR C++ compiler
> as these guys use a repository.
No, it's not quite the same; the compiler still needs to see the template
definitions. With Sun's compiler, and cfront, the link-time template
expansion will compile files never seen in the original compilation.
However, the original poster was assuming that the behavior of cfront,
duplicated in SunSoft C++, is the standard. It's not; the (draft)
standard makes no promises that the linker will go off and look in foo.C
for template definitions if you included foo.h.
In any case, the repo patch has some problems: it may require ten passes
to completely build STL programs, and it prevents you from building reusable
libraries without the risk of getting multiply defined symbols.
2.8.0 has a new solution, which is basically the same one Borland C++ uses
(roughly, common blocks for template expansions: each .o file gets a
template expansion of used functions but the linked executable gets only
one copy, eliminating duplicates).
--
-- Joe Buck http://www.synopsys.com/pubs/research/people/jbuck.html
Help stamp out Internet spam: see http://spam.abuse.net/spam/
- Raw text -