constructors/destructors compiled twice
Tom St Denis
tstdenis@ellipticsemi.com
Wed Jun 20 17:30:00 GMT 2007
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
More information about the Gcc-help
mailing list