This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: constructors/destructors compiled twice
- From: Tom St Denis <tstdenis at ellipticsemi dot com>
- To: KÃvesdi GyÃrgy <kgy at deverto dot hu>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 20 Jun 2007 13:16:38 -0400
- Subject: Re: constructors/destructors compiled twice
- References: <200706201836.02600.kgy@deverto.hu>
KÃvesdi GyÃrgy wrote:
> Hi,
>
> I would like to use C++ for 8-bit AVR CPUs, so saving space would be
> important.
> I found that the constructors and destructors always have two instances, which
> are exactly the same. I tried it for X86, X86/64, M68k, and AVR platforms,
> with the same result, so it is not platform-dependent.
>
You want to use C++ on an AVR? What the heck is wrong with you? The
AVR is the platform the least appropriate for a high level language.
> 000000f8 <valami::valami()>:
> f8: fc 01 movw r30, r24
> fa: 84 e0 ldi r24, 0x04 ; 4
> fc: 91 e0 ldi r25, 0x01 ; 1
> fe: 91 83 std Z+1, r25 ; 0x01
> 100: 80 83 st Z, r24
> 102: 13 82 std Z+3, r1 ; 0x03
> 104: 12 82 std Z+2, r1 ; 0x02
> 106: 08 95 ret
>
> 00000108 <valami::valami()>:
> 108: fc 01 movw r30, r24
> 10a: 84 e0 ldi r24, 0x04 ; 4
> 10c: 91 e0 ldi r25, 0x01 ; 1
> 10e: 91 83 std Z+1, r25 ; 0x01
> 110: 80 83 st Z, r24
> 112: 13 82 std Z+3, r1 ; 0x03
> 114: 12 82 std Z+2, r1 ; 0x02
> 116: 08 95 ret
>
>
Could you share the code?
Tom