This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Double the constructors, double the fun
- To: gcc-help at gcc dot gnu dot org
- Subject: Double the constructors, double the fun
- From: Timothy Housel <wileypob at yahoo dot com>
- Date: Thu, 2 Aug 2001 15:38:34 -0500
Hi. gcc 3.0 seems to be generating two constructors, which are
exactly the same for every constructor I write.
Take the following example:
foo.cpp:
class foo {
public :
foo ();
};
foo::foo() { }
main() { }
> gcc foo.cpp -o foo
> objdump -d foo
08048760 <_ZN3fooC2Ev>:
8048760: 55 push %ebp
8048761: 89 e5 mov %esp,%ebp
8048763: 83 ec 04 sub $0x4,%esp
8048766: c9 leave
8048767: c3 ret
08048768 <_ZN3fooC1Ev>:
8048768: 55 push %ebp
8048769: 89 e5 mov %esp,%ebp
804876b: 83 ec 04 sub $0x4,%esp
804876e: c9 leave
804876f: c3 ret
Why are there 2 constructors generated? I am working in a memory
limited environment and can't afford this kind of waste (if waste it be).
I should also note that gcc 2.95.3 doesn't do this. I searched all the
mailing lists and couln't find anything. Thanks for your help!
--
Tim Housel