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 reasons I’d like to use C++ are:
Do you see any reason to stick with C89 when developing for very limited hardware (4kb of RAM)?
Thank you for your answers, they were really helpful!
I thought the subject through and I will stick with C mainly because:
It is hard to accept one answer as you provided so many good answers. Unfortunately I can't create a wiki and accept it, so I will choose one answer that made me think most.
Two reasons for using C over C++:
Also, the original question, and a number of comments, mention the 4 Kb of RAM. For a typical embedded processor, the amount of RAM is (mostly) unrelated to the code size, as the code is stored, and run from, flash.
Certainly, the amount of code storage space is something to bear in mind, but as new, more capacious, processors appear on the market, it's less of an issue than it used to be for all but the most cost-sensitive projects.
On the use of a subset of C++ for use with embedded systems: there is now a MISRA C++ standard, which may be worth a look.
EDIT: See also this question, which led to a debate about C vs C++ for embedded systems.