Page 1 of 1

C++ default standard compilation

Posted: Mon Jul 31, 2023 12:10 pm
by Hamzah Hajeir
Hi there,

I maintain a full stack of Arduino libraries called (H4) that include H4AsyncTCP, H4AsyncMQTT, H4AsyncHTTP, H4AsyncWebserver, and H4Plugins.

I'm interested to know when will be an upgrade to the default compile C++ standard, as the current is (C++11), so to feel free using features of newer versions.

Thanks.

Re: C++ default standard compilation

Posted: Mon Jul 31, 2023 9:41 pm
by ESP_igrr
ESP-IDF uses C++20 (with GCC 11.2) in v5.0.x and C++23 (with GCC 12.1) in v5.1.

The next minor release, v5.2 is expected to use C++23 with GCC 13.1.

Given that your question is related to Arduino-esp32, I think the relevant milestone is v3.0.0 release, which is going to use IDF v5.1.x and therefore C++23.

Re: C++ default standard compilation

Posted: Wed Aug 02, 2023 11:40 am
by Hamzah Hajeir
ESP_igrr wrote:
Mon Jul 31, 2023 9:41 pm
ESP-IDF uses C++20 (with GCC 11.2) in v5.0.x and C++23 (with GCC 12.1) in v5.1.

The next minor release, v5.2 is expected to use C++23 with GCC 13.1.

Given that your question is related to Arduino-esp32, I think the relevant milestone is v3.0.0 release, which is going to use IDF v5.1.x and therefore C++23.
Thanks for the reply.

I see this, but I'm wondering why I see the compiler definition points to C++11 unless I explicitly switch it? I'm using PlatformIO.

Code: Select all

#define _CRT_STRINGIZE_(x) #x
#define _CRT_STRINGIZE(x) _CRT_STRINGIZE_(x)
#pragma message ("CPlusPlus " _CRT_STRINGIZE(__cplusplus))
Prints "CPlusPlus 201103L"

Note I'm using v2.11, which is based on ESP-IDF v4.4.5.

Is it a PlatformIO issue or arduino-esp32 related?

Regards,
Hamza

Re: C++ default standard compilation

Posted: Wed Aug 02, 2023 12:22 pm
by ESP_igrr
Hamzah Hajeir wrote: Note I'm using v2.11, which is based on ESP-IDF v4.4.5.
Seems correct, all releases <=v4.x have used -std=gnu++11. So to summarize,

- IDF v4.4.x and lower — C++11
- IDF v5.0.x — C++20
- IDF v5.1.x — C++23
- (future) IDF v5.2.x — C++23 (expected)

Re: C++ default standard compilation

Posted: Wed Aug 02, 2023 1:01 pm
by Hamzah Hajeir
ESP_igrr wrote:
Hamzah Hajeir wrote: Note I'm using v2.11, which is based on ESP-IDF v4.4.5.
Seems correct, all releases <=v4.x have used -std=gnu++11. So to summarize,

- IDF v4.4.x and lower — C++11
- IDF v5.0.x — C++20
- IDF v5.1.x — C++23
- (future) IDF v5.2.x — C++23 (expected)
Thank you, this makes full of sense.