Why are drivers and firmwares almost always written in C or ASM and not C++?

后端 未结 15 2366
庸人自扰
庸人自扰 2020-12-14 00:22

I am just curious why drivers and firmwares almost always are written in C or Assembly, and not C++?

I have heard that there is a technical reason for this.

15条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-14 00:59

    There are many style of programming such as procedural, functional, object oriented etc. Object oriented programming is more suited for modeling real world.

    I would use object-oriented for device drivers if it suites it. But, most of the time when you programming device drivers, you would not need the advantages provided by c++ such as, abstraction, polymorphism, code reuse etc.

提交回复
热议问题