[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] Duplicated C++ constructor code
From: |
Greg Tunnock |
Subject: |
Re: [avr-gcc-list] Duplicated C++ constructor code |
Date: |
Thu, 21 Nov 2002 22:23:36 +1100 (EST) |
Hi,
On Wed, 20 Nov 2002, Greg Tunnock wrote:
> Hi,
>
> I'm using avr-gcc-3.3.2002.10.01 on FreeBSD to compile C++ code. The listing
> file from avr-objdump show that the compile has duplicated the code for the
> class constructors.
<details removed>
> Is this a problem with avr-gcc? Or am I doing something silly? Or have I
> miss understood some aspect of C++?
I've found the answer to my own question. Is that like talking to yourself :-)
Duplicate identical C++ constructor generation is a feature/aspect of
gcc3.3. This aspect of gcc is document in the GCC Bugs web page under the
Non-bugs section <http://www.gnu.org/software/gcc/bugs.html#nonbugs>, which
says:
G++ emits two copies of constructors and destructors.
In general there are three types of constructors (and destructors).
1. The complete object constructor/destructor.
2. The base object constructor/destructor.
3. The allocating destructor/deallocating destructor.
The first two are different, when virtual base classes are involved. In some
cases we can do better, and this is logged in GNATS.
Cheers,
Greg Tunnock
avr-gcc-list at http://avr1.org