Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++ in embedded software programming [closed]

Is there significant problem, if I write the code for embedded linux system using C++ language programming ?.

Actually, I have intention to port some code to arm linux, with arm-uclibc compiler.

Thanks

like image 578
deddihp Avatar asked Mar 19 '10 04:03

deddihp


2 Answers

As I read your question, I was thinking about traditional embedded programming until I saw the Linux part. C++ can be used in embedded programming with caveats around hidden constructors, etc. If you're running Linux, I suspect that you don't need to worry about that stuff.

like image 179
Richard Pennington Avatar answered Nov 14 '22 03:11

Richard Pennington


Are you asking about plain C++ or embedded C++? As I understand it, embedded C++ is pretty much dead. You can program in C++, but, depending on your requirements, there may be some constructs that you will want to avoid using. For example, if you don't have much space, you may want to avoid templates as much as possible (or to explicitly instantiate templates) to keep your template instantiations to a minimum. You might also want to avoid exceptions or RTTI to reduce the amount of generated type information (to save space) and also to avoid having to deal with exception safety (to keep potential pitfalls to a minimum) as well as the high cost of exception propagation (to shorten the longest execution path, for real time systems). Virtual functions should be OK (they don't introduce that much overhead), but if you have very strict requirements, you may also need to limit your use of those. If you do use exceptions, you should also be sure that the compiler supports them (as many cross-compilers for embedded systems do not).

like image 27
Michael Aaron Safyan Avatar answered Nov 14 '22 05:11

Michael Aaron Safyan