mirror of
https://github.com/espressif/esp-idf.git
synced 2024-10-05 20:47:46 -04:00
docs: added new C++ language standard
This commit is contained in:
parent
8f7a076619
commit
6991a92895
@ -32,7 +32,7 @@ extern "C" {
|
||||
* - MACRO_ARGS(__VA_ARGS__) if __VA_ARGS__ was not empty
|
||||
* - MACRO_NO_ARGS() if __VA_ARGS__ was empty
|
||||
*
|
||||
* @note In the future, we want to switch to C++20. We also want to become compatible with clang. Hence, we provide two
|
||||
* @note In the future, we want to become compatible with clang. Hence, we provide two
|
||||
* versions of the following macros which are using variadic arguments. One is using the GNU extension ##__VA_ARGS__.
|
||||
* The other is using the C++20 feature __VA_OPT__(,). This allows users to compile their code with standard C++20
|
||||
* enabled instead of the GNU extension. Below C++20, we haven't found any good alternative to using ##__VA_ARGS__.
|
||||
|
@ -288,7 +288,7 @@ void esp_log_writev(esp_log_level_t level, const char* tag, const char* format,
|
||||
/// Log at ``ESP_LOG_ERROR`` level. @see ``printf``,``ESP_LOGE``,``ESP_DRAM_LOGE``
|
||||
|
||||
/**
|
||||
* In the future, we want to switch to C++20. We also want to become compatible with clang.
|
||||
* In the future, we want to become compatible with clang.
|
||||
* Hence, we provide two versions of the following macros which are using variadic arguments.
|
||||
* The first one is using the GNU extension \#\#__VA_ARGS__. The second one is using the C++20 feature __VA_OPT__(,).
|
||||
* This allows users to compile their code with standard C++20 enabled instead of the GNU extension.
|
||||
|
@ -23,14 +23,14 @@ esp-idf-cxx Component
|
||||
C++ language standard
|
||||
---------------------
|
||||
|
||||
By default, ESP-IDF compiles C++ code with C++20 language standard with GNU extensions (``-std=gnu++20``).
|
||||
By default, ESP-IDF compiles C++ code with C++23 language standard with GNU extensions (``-std=gnu++23``).
|
||||
|
||||
To compile the source code of a certain component using a different language standard, set the desired compiler flag in the component CMakeLists.txt file:
|
||||
|
||||
.. code-block:: cmake
|
||||
|
||||
idf_component_register( ... )
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE -std=gnu++2b)
|
||||
target_compile_options(${COMPONENT_LIB} PRIVATE -std=gnu++11)
|
||||
|
||||
Use ``PUBLIC`` instead of ``PRIVATE`` if the public header files of the component also need to be compiled with the same language standard.
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user