The C++17 version of the Xtensa C++ compiler supports designated initializers?
Posted: Mon Feb 06, 2023 2:19 am
I was just puzzling over something...
My ESP-IDF v5.0 application is written in C++. In my main CMakeList.txt I have the following settings:
I added the following statement in my `main.cpp` to check:
The output I received is:
This is all as I would expect. However, I am able to use designated initializers for regular C structures in this code. For example:
Using "standard" C++17 I would have expected this to generate a compiler error since the documentation I've read says that designated initializers aren't supported until C++20.
Is the Xtensa C++ compiler different in this regard? If so, is there any documentation regarding in what ways it deviates from the standard?
My ESP-IDF v5.0 application is written in C++. In my main CMakeList.txt I have the following settings:
Code: Select all
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
Code: Select all
std::cout << __cplusplus << "\n";
Code: Select all
201703
Code: Select all
// Initialize PWM
ledc_timer_config_t ledcTimer = {
.speed_mode = _ledcMode, // timer mode
.duty_resolution = _ledcResolution, // resolution of PWM duty
.timer_num = LEDC_TIMER_0, // timer index
.freq_hz = 5000, // frequency of PWM signal
.clk_cfg = LEDC_AUTO_CLK // Auto select the source clock
};
ledc_timer_config(&ledcTimer);
Is the Xtensa C++ compiler different in this regard? If so, is there any documentation regarding in what ways it deviates from the standard?