[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[avr-gcc-list] c++ problems
From: |
Branislav Katreniak |
Subject: |
[avr-gcc-list] c++ problems |
Date: |
Thu, 21 Jul 2005 09:38:26 +0200 |
User-agent: |
Mutt/1.5.9i |
Hi all,
I am trying to use C++ on the avr devices. I found it very usable, but I
have noticed several problems not mentioned in the FAQ. I am using
WinAVR 20050214.
- Constructors and destructors are twice in the .text section.
Code example:
class Test {
Test();
~Test();
};
Test::Test() { }
Test::~Test() { }
Compiled code:
test.o: file format elf32-avr
Disassembly of section .text:
00000000 <_ZN4TestC2Ev>:
class Test {
Test();
~Test();
};
Test::Test() { }
0: 08 95 ret
00000002 <_ZN4TestC1Ev>:
2: 08 95 ret
00000004 <_ZN4TestD2Ev>:
Test::~Test() { }
4: 08 95 ret
00000006 <_ZN4TestD1Ev>:
6: 08 95 ret
When constructors and destructors get bigger, this eats much code space.
How can this be eliminated?
- Virtual tables (I suppose) are stored in RAM.
This eats RAM memory but is no problem when virtual functions are not
used.
- No support for pure virtual function.
No big problem, just to mention.
- I cannot get rid off this warning.
test.c:1: warning: alignment of 'TestVirtual::_ZTV11TestVirtual' is
greater than maximum object file alignment. Using 1
What does it mean? It appears for every class with virtual functions.
Brano
--
Branislav Katreniak
mailto: address@hidden
- [avr-gcc-list] c++ problems,
Branislav Katreniak <=