🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.g++.bug
Article #959

template class member functions never expanded inline gcc-2.2.2

#959
From: dak
Date: Tue, 15 Sep 1992 01:57
62 lines
2151 bytes
In template classes no inline functions are generated regardless of
optimization level. This makes the template business (specific
efficient instances for general problems) rather ineffective.
Although it does not strictly qualify as a bug, it should not
be too hard to correct (some people will kill me for that remark)
that. Take the (sad) code for the following simple piece, which
can be cleaned up remarkably by removing the template.

I would like templates just to behave as efficient than their counter-
parts. If that means not sharing code between template instantiations,
so be it. The usual application will not use more than maybe two
instances of one template.

Reading specs from /usr/local/lib/gcc-lib/i386-isc-isc/2.2.2/specs
gcc version 2.2.2
 /usr/local/lib/gcc-lib/i386-isc-isc/2.2.2/cpp -lang-c++ -v -undef -D__GNUC__=2 -D__GNUG__=2 -D__cplusplus -Dunix -Di386 -D__unix__ -D__i386__ -D__unix -D__i386 -D__OPTIMIZE__ mm.cc /usr/tmp/cca00819.i
GNU CPP version 2.2.2 (80386, ATT syntax)
 /usr/local/lib/gcc-lib/i386-isc-isc/2.2.2/cc1plus /usr/tmp/cca00819.i -quiet -dumpbase mm.cc -O -version -o mm.s
GNU C++ version 2.2.2 (80386, ATT syntax) compiled by GNU C version 2.2.2.
template <class T>
class k {
	int n;
public:
	k(const int m) {
		n = m;
	}
};

main()
{
	k<int> j(5);
	return 0;
}


	.file	"mm.cc"
gcc2_compiled.:
.text
	.align 4
.globl main
main:
	pushl %ebp
	movl %esp,%ebp
	subl $4,%esp
	pushl $5
	leal -4(%ebp),%eax
	pushl %eax
	call __t1k1Zii
	xorl %eax,%eax
	leave
	ret
	.align 4
	.align 4
__t1k1Zii:
	pushl %ebp
	movl %esp,%ebp
	movl 8(%ebp),%eax
	movl 12(%ebp),%edx
	movl %edx,(%eax)
	leave
	ret
	.align 4
Technical Details
Message-ID: <9209142157.AA09787@tabaqui>
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pool.INformatik.rwth-aachen.DE!dak

Show Full Headers
Complete Article Headers
Newsgroups: gnu.g++.bug
Path: arc1-ca.pugleaf.net!sparky!uunet!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!pool.INformatik.rwth-aachen.DE!dak
From: dak@pool.INformatik.rwth-aachen.DE
Subject: template class member functions never expanded inline gcc-2.2.2
Message-ID: <9209142157.AA09787@tabaqui>
Sender: gnulists@ai.mit.edu
Organization: GNUs Not Usenet
Distribution: gnu
Date: Tue, 15 Sep 1992 01:57:46 GMT
Approved: bug-g++@prep.ai.mit.edu
Lines: 65