12

The "Arduino language" (as they call it) of the Arduino IDE 1 is obviously C++. Which C++ exactly?

I tried to figure it out myself (Arduino IDE 1.8.13 for Arduino Uno), but I can't conclude what C++ standard it supports.

From these tests, it seems to support C++14

  • C++ 14 variable templates are supported (template<typename T> constexpr T pi = T(3.1415926535);)

  • C++ 14 lambda captures are supported (auto lambda = [value = 1] {return value;};)

  • C++ 14 deprecated is supported ([[deprecated]]int fdep(){return 5;})

But not fully:

  • C++ 14 digit separators are not supported (int j = 2'000;)

From these tests, it even seems to support some C++17:

  • Nested namespace definitions are supported (namespace X::Y {int func(){ return 1; } })

But also not fully:

  • UTF-8 characters are not supported (char x = u8'a';)

If it partially supports everything, is there an overview like a list or table where I can look it up?

Thomas Weller
  • 1,058
  • 1
  • 8
  • 22

1 Answers1

15

The Arduino "language" is nothing more than a set of C++ functions and classes. It does not mandate any particular C++ standard.

The standard is dictated purely by the compiler that the core you are using happens to support (and is configured to use through command line flags).

Different cores use different compilers. Different versions of the same core use different compilers. Different compilers provide different C++ standard levels.

Most cores use GCC or some variant thereof. That could be anything from GCC 3.x.x through to the most recent release (whatever that is this week).

Currently the AVR core uses GCC 7.3.0 and is configured to use the gnu++11 standard by default (though avr-gcc and the associated libraries lack a full STL implementation). You can of course change that in the configuration files if you want.

Majenko
  • 105,851
  • 5
  • 82
  • 139