Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
is the c or c++ is an optimal choice for embedded system
Posted
Comments
Mohibur Rashid 1-Jul-12 22:47pm    
What embedded device are you talking about? cause there is embedded device where C will be bad choice too. Some Micro-controller of PIC they have memory for 1024 or less executable memory

Depends on what you are doing: I have used both C and Embedded C++ to good effect in embedded applications.

Generally, if your processor and memory are small, you will be better off with C, but Embedded C++ (rather than full-fat C++) can work really well.

Which languages are available for your target processor is a much, much better question!
 
Share this answer
 
The definition of embedded software has expanded somewhat to include development on platforms that use different versions of UNIX already ported and given to developers as a part of the development package.

If that is the case you most likely will use GNU C/C++. However, I don't consider this an embedded system.

Plus you have Android, plus you get Windows CE so the boundaries of what is "embedded" are blurred somewhat (especially in job ads :))

Having stated the above, it is still the case that 90% or more of classic, bare-bone embedded system software projects are written in C.

The reasons why this has occurred:
C++ has a heavyweight run-time environment and porting to a new platform would require a fair bit of work before you even start coding the application (examples - exception processing);
C++ cross compilers generally are less mature. Having compiler problem is the last thing you want in an embedded project so choose wisely;
Good C cross-compilers are extremely mature and generate phenomenally efficient code (important for real-time environment);
Embedded C++ (EC++) has not taken off and will not in my opinion;
Scale of the project is typically such that C++ advantages are not as obvious as for desktop or mobile app development.

Overall, stick with 'C' you cannot go wrong.
 
Share this answer
 
Comments
SoMad 1-Jul-12 22:35pm    
Good answer, +5.

Soren Madsen
Optimality will depend on your context of what you are trying to do and the kind of hardware you will be running on, if you are familiar with c or c++ then probably it will be better and more performant.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900