C++ usage in embedded systems

后端 未结 17 1497
南旧
南旧 2021-01-30 22:45

What features of C++ should be avoided in embedded systems?

Please classify the answer by reason such as:

  • memory usage
  • code size
  • speed<
17条回答
  •  盖世英雄少女心
    2021-01-30 23:25

    Make sure you know what features are supported by the compiler for your embedded platform and also make sure you know the peculiarities of your platform. For example the TI's CodeComposer compiler does not do automatic template instantiations. As a result, if you want to use STL's sort, you need to instantiate five different things manually. It also does not support streams.

    Another example is that you may be using a DSP chip, which does not have hardware support for floating point operations. That means every time you use a float or a double you pay the cost of a function call.

    To summarize, know everything there is to know about your embedded platform and your compiler, and then you will know which features to avoid.

提交回复
热议问题