Templates in C++

jcohen@juniper.tc.cornell.edu (Jeffrey Cohen)
Thu, 11 May 1995 14:48:17 GMT

          From comp.compilers

Related articles
Templates in C++ jcohen@juniper.tc.cornell.edu (1995-05-11)
Re: Templates in C++ litsios@iis.ee.ethz.ch (1995-05-12)
Re: Templates in C++ jsgray@ix.netcom.com (1995-05-12)
Re: Templates in C++ shepherd@schubert.sbi.com (1995-05-12)
Re: Templates in C++ norman@flaubert.bellcore.com (1995-05-14)
Re: Templates in C++ davidm@flora.Rational.com (1995-05-16)
Re: Templates in C++ jgmorris@cs.cmu.edu (Greg Morrisett) (1995-05-17)
[7 later articles]
| List of all articles for this month |

Newsgroups: comp.compilers
From: jcohen@juniper.tc.cornell.edu (Jeffrey Cohen)
Keywords: C++, performance, question, comment
Organization: Cornell Theory Center
Date: Thu, 11 May 1995 14:48:17 GMT

With all this discussion of the performance differences between
C and C++, I didn't see one reference to C++ templates. How does
this effect performance? Is the performance highly dependent on
the compiler used or are the algorithms for compilation similar
across compilers? Do these problems get worse when templates
are used recursivly? As parent classes? With multiple parameters.


As an example. If you were generating a matrix class, would better
code be generated through a generic class or by using a template
class that has two integers. I think it should be the template
class since the bounds are known and the compiler can better
optimise the code. Is this true and why?


--
Jeffrey David Cohen
jcohen@dri.cornell.edu
http://www.cs.cornell.edu/Info/People/cohen/cohen.html
finger or www for pgp key
[I was under the impression that the biggest practical problem with templates
is avoiding redundant instantiation when you have separately compiled modules.
Other than that, they act very much like macros, which don't present great
compiling problems. -John]
--


Post a followup to this message

Return to the comp.compilers page.
Search the comp.compilers archives again.