This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Unit at a time C++ again
On Wed, Jun 18, 2003 at 11:32:39PM -0700, Mark Mitchell wrote:
> The template instantiation part of the issue is pretty clear: in big C++
> programs many (if not most) of the functions are template
> instantiations. Trying to make decisions before template instantiation
> is not worth it.
It's possible that there could be exceptions: for some templates, it
can be determined by inspection that an inlined call is always cheaper
than a non-inlined call, regardless of the values of the type parameters
(because the template function or member function returns a trivial
expression), meaning that even with -Os inlining pays.
The STL has hundreds of such templates.
On the other hand, if the templates are going to be instantiated anyway,
it might still be best to ignore this.