This is the mail archive of the gcc-help@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: constructors/destructors compiled twice


Brian Sidebotham wrote:
>
>> 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.
>
> The AVR was developed between Atmel and IAR. IAR had a large influene
> on the instruction set to make sure it would be very efficient at
> running code developed in C.
>
> So, I guess there's not that much "wrong" with him! ;-)

The typical AVR has about 512 words of code memory.  Unless you're using
a "mega" variant using C let alone C++ on an AVR is going to waste all
of your space.

That said, C++ for most embedded work is inappropriate for other
reasons, aside from larger code, it also makes more extensive use of the
heap in less explicit manners. 

Not saying you can't do C++ on embedded, just that in mosts cases you
probably shouldn't.

Tom


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]