Hi Peter, On 29/06/07, Peter P. wrote: > > exception handling => safety critical stuff > > exception handling => race condition on small micro How do you generate race conditions using exceptions in the first place? They have no relation at all. > > templates => flexible libraries (reduces development costs) > > flexible libraries with C++ calling conventions => huge memory and code > overhead, high library porting and maintenance cost In the case of templates, probably smaller code and memory overhead since you decide per type what to store, instead of for a generic type, less porting (as c++ remains c++) and maintenance cost of near zero, since it's portable code as you're not using compiler specifics to make it work properly. > > "better C part of C++" => less coding errors > > worse C++ expands C => the temptation to use automatic strings on a micro with > limited RAM, the temptation to use inheritance and object collection on same, > the temptation to call by reference in a non-memory protected environment > > Also code footprint 30% to 300% of optimized C code. I wouldn't use strings, vectors or any STL on a micro in any case. The most code overhead you receive from properly written C++ code is the overhead C code would've generated, except that you commonly forget to check those boundaries. If you're tempted to pretend you're working on a home computer, your code will be slow anyway, even if you program in C. I have seen worse C code, every bit of code making their own small buffer, the whole using half the memory as buffer not being able to use more than 2% of it at any time because there's only one thread running at all. Making C++ code work properly is possibly easier than making the corresponding C code work properly. I've tried to make a few small demos indicating how much overhead your code has when it doesn't do much. In most cases, turning on any optimization optimized away /the entire program/. I'll dare you to beat that with C. Regards, Peter -- http://www.piclist.com PIC/SX FAQ & list archive View/change your membership options at http://mailman.mit.edu/mailman/listinfo/piclist