I’m interested in compiling a list of c++ features that are not advisable for use in embedded systems (and which may cause people to recommend c over c++). Please try to add why if you know, or add your why to others’ answers.
Here’s one for a start (the only one I know)
- Dynamic polymorphism, don’t know why, but someone said it’s “costly”
Certain features require run-time support, so if you miss the required support, you should avoid those features. In particular, the following features usually need extra run-time support:
People also usually mention templates, but they are only an advanced macro facility — so you can freely use them in embedded systems. Still, you might want to avoid them since they can lead to code bloat after compilation.
Your embedded system should come with documentation saying what, if any, run-time support for C++ (and otherwise) is available.