C++ on Small-Footprint Microcontrollers

后端 未结 6 2204
隐瞒了意图╮
隐瞒了意图╮ 2020-12-05 00:39

It seems to me people consistently shy away from, or rather vehemently oppose the use of, C++ on microcontrollers, but I can\'t for the life of me figure out why. If you sta

6条回答
  •  暗喜
    暗喜 (楼主)
    2020-12-05 01:11

    Of course it varies a lot.

    I wouldn't use virtual inheritance on a "small" MCU. I wouldn't even use a heap at all.

    The features of C++ that seem most attractive in that space are namespaces (to share software components between programs for networked MCUs), templates (e.g., to parameterize protocols over I/O ports), and general semantic improvements like static_cast and less coarse integral promotion.

    But, at least in my brief foray into professional embedded, a suitable C++ compiler simply didn't exist, and the crappy one that was available cost thousands a year.

    GCC is the most capable, widely-available C++ compiler available for embedded platforms. However, its platform support is very uneven. If you have unlimited resources, EDG advertises that they will bring support superior to Comeau to "your" embedded platform.

提交回复
热议问题