Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

"C is simplistic and can be considered dead the day C++ compilers catch up with speed and memory allocation"

Those really are not the problems that are most pressing with C++ in the embedded field. Comparable speed is rarely noticeably different provided you avoid certain key things, and you can always just swap in a new allocator if you want.



By memory allocation I meant memory usage by the compiler itself. Plus libstdc++ which is not easy to get rid of, and if you do dump it, you at least cut off C++ exceptions.

I once switched from C++ to C because g++ just couldn't handle the module even having all optimizations turned off. That was a huge automatically generated C module with thousands of functions. A rather rare situation but showed very clearly that C++ is not almighty.


Compiler speed/memory use are generally entirely irrelevant with embedded stuff. If you're natively building on your tiny target instead of cross compiling from your beefy workstation, you're doing it wrong.

No, for the very real issues with C++ in small installations, you will have to look at the language itself.


Believe it or not, it was on a beefy workstation (I think the number of functions was tens of thousands actually). Of course I could have split the module or find some other solution, but the thing was, switching to C solved the problem. More importantly, I was able to switch on compiler optimizations.


I am not getting what makes this any different from any other very large build then.


The size of a single module with say 50,000 automatically generated functions 3 to 10 lines each. You want to try it? ;)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: