Is there any reason to use C instead of C++ for embedded development?

后端 未结 30 3735
既然无缘
既然无缘 2020-11-30 17:20

Question

I have two compilers on my hardware C++ and C89

I\'m thinking about using C++ with classes but without polymorphism (to avoid vtables). The main r

30条回答
  •  余生分开走
    2020-11-30 17:57

    It depends on the compiler.

    Not all embedded compilers implement all of C++, and even if they do, they might not be good at avoiding code bloat (which is always a risk with templates). Test it with a few smaller programs, see if you run into any problems.

    But given a good compiler, no, there's no reason not to use C++.

提交回复
热议问题