Article View: gnu.g++.help
Article #896Re: SGI and C++
From: Shankar Unni
Date: Mon, 19 Feb 1996 21:46
Date: Mon, 19 Feb 1996 21:46
39 lines
2139 bytes
2139 bytes
Thomas Sippel - Dau (vulture@imperial.ac.uk) wrote:
> Essentially that is because the gcc implementation of templates is along
> the lines of "proovide the minimum necessary to get it going", while
> the ATT code (on which the SGI compiler is based) used a more general
> approach.
Umm, the SGI compiler is NOT ATT-based (at least, not since
Irix 5.3/Irix 6.0.1).
I assume the original poster meant that the generated code ran slowly, not
that the compilation itself was slower..
There *is* a known bug that I found recently (for which there won't be a fix
in Irix 6.2, since we found the problem too late to get into that release - it
will be fixed in a patch), where if you declare a template member function
in the following way, it's NOT inlined:
template <class T> class Foo {
...
void memfunc(); /* no inline specification here */
...
};
template <class T> inline Foo<T>::memfunc()
{
/* defined as inline, but compiler will fail to inline it */
}
The workaround for this problem is to stick the inline keyword before the
declaration of the member function inside the template class.
This *may* be the reason for the slowness. In all other respects, there
should be no difference between template and non-template code.
--
Shankar Unni E-Mail: shankar@sgi.com
Silicon Graphics Inc. Phone: +1-415-933-2072
URL: http://reality.sgi.com/employees/shankar
Technical Details
Message-ID:
<4gar2s$905@fido.asd.sgi.com>Path:
arc1-ca.pugleaf.net!engr.sgi.com!shankarReferences:
<4f609s$rho@fu-berlin.de> <4f6726$4ch@fido.asd.sgi.com> <4fahih$s13@fu-berlin.de> <4fbhs0$eo3@fido.asd.sgi.com> <4fl2nh$b66@sun20.ccd.bnl.gov> <4ga186$bk2@oban.cc.ic.ac.uk>Show Full Headers
Complete Article Headers
Path: arc1-ca.pugleaf.net!engr.sgi.com!shankar From: shankar@mti.sgi.com (Shankar Unni) Newsgroups: gnu.g++.help,comp.lang.c++,comp.sys.sgi.apps,comp.sys.sgi.misc Subject: Re: SGI and C++ Followup-To: gnu.g++.help,comp.lang.c++,comp.sys.sgi.apps,comp.sys.sgi.misc Date: 19 Feb 1996 21:46:04 GMT Organization: Silicon Graphics, Inc., Mountain View, CA Distribution: world Message-ID: <4gar2s$905@fido.asd.sgi.com> References: <4f609s$rho@fu-berlin.de> <4f6726$4ch@fido.asd.sgi.com> <4fahih$s13@fu-berlin.de> <4fbhs0$eo3@fido.asd.sgi.com> <4fl2nh$b66@sun20.ccd.bnl.gov> <4ga186$bk2@oban.cc.ic.ac.uk> Reply-To: shankar@engr.sgi.com NNTP-Posting-Host: boris.mti.sgi.com X-Newsreader: TIN [version 1.2 PL2]