1

Why Arduino didn't use the complete C++?

Comments
  • 12
    Because it is just a puny microcontroller which is also hindered by Arduino firmware? C is enough for it and much easier to implement
  • 3
    Because there requirements are fairly high looking from an embedded perspective
  • 6
    @iiii Arduino does use C++, but not the complete language. You can use C++ on microcontrollers, but you have to know which language features you have to avoid due to resource constraints.

    C++ has the "don't pay for what you don't use" policy, not "don't pay for what you do use".
  • 0
    @Fast-Nop I know that it's is possible to use fully, but the compiler would be much more complex, as far as I understand, if you would use something more than "C with classes"
  • 3
    @iiii The compiler is actually GCC anyway - though GCC is about to lose its AVR backend because nobody really cares to maintain it.

    Things that you shouldn't use on an 8 bit controllers would be e.g. exceptions, and anything that involves dynamic memory allocation is also problematic if you want reliable programs.
  • 0
    The real question is why don't we have ARM or RISC-V chips for these applications and still rely on an 8Bit architecture
  • 4
    @LotsOfCaffeine newsflash: there is an ARM based Arduino. It's called Arduino Due
  • 0
    @iiii that is news to me, but apparently it's kind of discontinued?
    https://forum.arduino.cc/t/...
  • 2
    @LotsOfCaffeine Besides the Due, there are also the new Nano (IoT, BLE, ...), MKR and Portenta boards.
    The Due can still be bought from the official store (or maybe it is possible again?).

    There is a lot of software optimized for 8 bit or AVR, and most ARM boards use 3,3V while most AVR ones use 5V.
  • 0
    @LotsOfCaffeine there's some Risc-V board that is basically like an arduino or esp 8266
  • 4
    @LotsOfCaffeine Because RISC-V is in experimental state, and what you get are overpriced eval boards with crappy peripherals. Neither fit not meant for actual use, rather for testing.

    And ARM Cortex-M is cool, but it's also pretty complex. Arduino is meant for non-techies such as model railway tinkerers, and that's not the audience for ARM.

    @sbiewald Unoptimised SW on ARM still would run circles around optimised SW on AVR, and a 5V level shifter wouldn't really blow up the BOM.
  • 3
    @LotsOfCaffeine well, it existed at least 🤷‍♂️
  • 1
    It is a starter platform. Plus, you can still use cpp libraries.
  • 0
    @Fast-Nop Does gcc treat it as an architecture target ?
  • 0
    @MadMadMadMrMim GCC has no architecture target like Clang. You build GCC for every host/target combo.
  • 0
    @Fast-Nop that doesn’t make sense
    How could you compile the Android is on Linux then ? That runs arm
  • 1
    @Fast-Nop oh do you mean you compile gcc to run on the host and for a specific arch only ?
  • 0
    @MadMadMadMrMim You can cross-compile GCC. Actually though, you don't use GCC for Android anymore, you use Clang, that's what the NDK has been doing for years - after phasing out GCC.

    But the point with AVR is that GCC11 will get considerable changes, and there is no maintainer for the back end code that generates AVR code. Arduino has never contributed much except their IDE, and Atmel doesn't care.
  • 1
    @Fast-Nop Hehe my only experience with clang is a bug that would cause gcc to freeze forever while building it

    I forget what source package I was building that required it
  • 0
    @MadMadMadMrMim Clang generates good code for x86 and ARM64, but the Cortex-M code generation cannot compete with GCC.
Add Comment