Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

RE: [AVR-Chat] Mixing gcc C & C++

2012-11-27 by Chuck Hackett

Forgot one other question:  

Is it not advisable to use C++ for embedded AVR projects due to excess code
size, etc.?

When I say "excess" code size I mean unreasonable when taken in light of the
advantages of C++ for encapsulation, etc., etc.  

I realize that the answer to this is different for different circumstances
but just looking for a general guideline.  I am willing to buy a larger
processor to gain the advantages of C++ but I realize that there is a limit
to this because of the limits of AVR memory space.

I also realize that this is an area like ASM .vs. C: you can usually
generate more compact and efficient code using ASM but there are advantages
to using a higher level language such as C and each person/project has to
weigh the pros & cons.

I'm looking for comments such as one would make advising someone not to use
"printf" in embedded projects (pulls in a lot of code and increases stack
usage) - I use it for formatting debugging messages, etc. but realize that I
might have to give it up if I get close to the code space limit.
 
Cheers,

Chuck Hackett
"Good judgment comes from experience, experience comes from bad judgment"
7.5" gauge Union Pacific Northern (4-8-4) 844
http://www.whitetrout.net/Chuck

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.