Try it in your intended application and see if the performance meets the requirements.
What do you mean? The C++ standard library is written in C++, and most C++ compilers are written in C++. (And so are modern C compilers: GCC, Clang and MSVC are all written in C++ these days.)
Ok, all your answers are very helpful! I have only two questions: What about fragmentation of memory pn ARM/RISC MCU? What is version of C++ supported (Upd.) And can you update it?
In general, the more ram you have, the less fragmentation is likely to occur (perhaps also because you get a more complex malloc/free.) Most ARMs have 32k or more. (Compared to 2k on an atmega328.)
Most arduino platforms are set up to request std=g++11, ie C++11 plus gnu extensions.
And can you update it?
Not easily.
You can change options by finding and editing the “platform.txt” file, but most platforms are using an old version of gcc (v7.3), and you need to worry about “why.” (For avr, gcc7 is the latest version supported by the chip vendor.)
@westfw But if we have ESP32, the version of gcc will be different, won't it? According C++ Support - ESP32 - — ESP-IDF Programming Guide v5.3.1 documentation it supports C++23, but can it used in Arduino IDE?
Version v3.x of the ESP32 Arduino core is at C++23. That works no matter whether you use the Arduino IDE or a 3rd-party IDE with Arduino plugin.
Teensy supports C++17.
As I said, why don't you just try the code you want to use in your intended project and see if it's performance meets specifications?
All 4 compilers for ESP32 (ESP32, ESP32 S2, ESP32 S3, and ESP32 C (RISC-V)) seem to be version 12.2, and the IDE enableds -std=gnu++2b (C++23 draft, plus gnu, I guess?)
On my system, I see:
arm-none-eabi-c++ (GCC) 10.3.0
riscv32-esp-elf-c++ (crosstool-NG esp-12.2.0_20230208) 12.2.0
xtensa-esp32s3-elf-c++ (crosstool-NG esp-2021r2-patch5) 8.4.0
xtensa-esp32-elf-c++ (crosstool-NG esp-12.2.0_20230208) 12.2.0
xtensa-esp32s2-elf-c++ (crosstool-NG esp-12.2.0_20230208) 12.2.0
xtensa-esp32s3-elf-c++ (crosstool-NG esp-12.2.0_20230208) 12.2.0
xtensa-esp32-elf-c++ (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a) 5.2.0
xtensa-lx106-elf-c++ (crosstool-NG 1.20.0) 4.8.2
xtensa-lx106-elf-c++ (GCC) 10.3.0
avr-c++ (GCC) 7.3.0
arm-none-eabi-c++ (GNU Tools for ARM Embedded Processors) 4.8.3 20140228 (release) [ARM/embedded-4_8-branch revision 208322]
arm-none-eabi-c++ (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]
arm-none-eabi-c++ (GNU Tools for Arm Embedded Processors 9-2019-q4-major) 9.2.1 20191025 (release) [ARM/arm-9-branch revision 277599]
arm-none-eabi-c++ (xPack GNU Arm Embedded GCC x86_64) 13.2.1 20231009
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.