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

Some of C++ features are great, as recently discussed on the Linux kernel mailing list. However for many of Cs usecases, they are not appropriate, like exceptions and RAII in embedded. Once you start disabling major features those 'power tools' become far less attractive. Also, to extend the metaphor, hand tools are usually obvious and easy to use while power tools can have very long manuals. See for example the 275 page book on just Initilisation in C++ [0].

[0] https://www.cppstories.com/2022/cpp-init-book/



How is RAII a problem on embedded platforms? It is basically about scoped cleanup, something you would otherwise have to do manually.


Not sure what waa meant but what comes to mind to me who has dabbled in embedded is that in C it’s painfully clear how long “objects” live and when you tear them down and how. In C++ stuff can easily “happen” at an inopportune moment.


Same in C++: happens at the end of the scope. You precisely control where that is.




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

Search: