14 ms·
Just like C libraries are a bad fit for embedded, no difference there, although C++ haters pretend otherwise, even though half of libc is unusable in freestandi
by pjmlp 11mo ago
Just like C libraries are a bad fit for embedded, no difference there, although C++ haters pretend otherwise, even though half of libc is unusable in freestanding.
It takes skill to make use of Arduino, ESP32, and other C++ embedded libraries, being able to write custom C++ libraries, master compiler switches and linker maps.
- 112233 10mo agoC libraries are excellent for embedded! You can write libraries like SQLite, that can run on bare metal and only require a few external functions from the platform, while still being valid C library! You cannot make it in C++, because any valid C++ library imposes massive requirements on the environment I already mentioned. C does no such thing!
- pjmlp 10mo agoSome people have the skills to make C++ work on a GBA, https://github.com/GValiente/butano https://github.com/GValiente/butano Arduino, https://docs.arduino.cc/arduino-cloud/guides/arduino-c/ https://docs.arduino.cc/arduino-cloud/guides/arduino-c/ Or even ESP32, https://docs.espressif.com/projects/esp-idf/en/stable/esp32/api-guides/cplusplus.html https://docs.espressif.com/projects/esp-idf/en/stable/esp32/... Others do not. As for C does not such thing, strangly there are enough examples from TI, Microchip, Atmel that prove otherwise.
- 112233 10mo agoThese are great, thanks! That GBA "butano" compiles with -fno-rtti -fno-exceptions, so it is not a C++ engine/library according to C++ standard! It is, however, an impressive piece of work. The ESP32 SDK (I lol'd at your "even", those Xtensa/RISCV chips can even run linux kernel!) is extremely impressive - they support enabling/disabling rtti and exceptions (obviously disabled by default, but the fact they implemented support for that is amazing). So "real C++" is possible on ESP32, which is good to know. For comparision, here are the minimum SQLite dependencies from the submitted article: memcmp() memcpy() memmove() memset() strcmp() strlen() strncmp() Of course you could run javascript and erlang on MCU too, but is that API better than C? Your claim of "skill issue" sounds like RedBull challenge. Please let us unskilled people simply call library functions.