C++ default standard compilation

Hamzah Hajeir
Posts: 11
Joined: Tue Dec 27, 2022 6:02 pm

C++ default standard compilation

Postby Hamzah Hajeir » Mon Jul 31, 2023 12:10 pm

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.

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: C++ default standard compilation

Postby ESP_igrr » 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.

Hamzah Hajeir
Posts: 11
Joined: Tue Dec 27, 2022 6:02 pm

Re: C++ default standard compilation

Postby Hamzah Hajeir » Wed Aug 02, 2023 11:40 am

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

ESP_igrr
Posts: 2067
Joined: Tue Dec 01, 2015 8:37 am

Re: C++ default standard compilation

Postby ESP_igrr » Wed Aug 02, 2023 12:22 pm

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)

Hamzah Hajeir
Posts: 11
Joined: Tue Dec 27, 2022 6:02 pm

Re: C++ default standard compilation

Postby Hamzah Hajeir » Wed Aug 02, 2023 1:01 pm

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.

Who is online

Users browsing this forum: Google [Bot] and 209 guests