C is lower level and does exactly what you say. It is more adapted to low-resource environments such as microcontrollers.
C ++ as some functions that require additional resources (such as OOP, exception, etc.).
In addition, the microcontroller does not have the same functions as your computer. This may, for example, not support loading a dynamic library, and even for static libraries that are limited in size, since your chip does not have a lot of memory.
Microcontrollers typically provide a dedicated I / O library, and stdlib is not always available.
What you need is a cross-compiler for your microcontroller. Then you can write your program in C and ASM.
If the chip supports it, you can recompile stdlib to use the standard C functions, and then you can (again, if the chip has enough resources) build a C ++ cross-compiler, and then STL. Then you can create a C ++ program on your chip, but the program will weigh much more than the original C program.
Geoffroy
source share