Merge branch 'docs/translate_c_support' into 'master'

docs: Provide translation for c.rst

Closes DOC-7522

See merge request espressif/esp-idf!29863
This commit is contained in:
Shen Meng Jing
2024-04-26 15:18:39 +08:00
2 changed files with 36 additions and 5 deletions

View File

@@ -3,9 +3,7 @@ C Support
:link_to_translation:`zh_CN:[中文]`
.. highlight:: cpp
ESP-IDF is primarily written in C and provides C APIs. `Newlib <https://sourceware.org/newlib/>`_ is used as standard C library (the Newlib version can be found in :component_file:`newlib/sbom.yml`). In general, all C features supported by the compiler, currently GCC, should be available in ESP-IDF, unless specified in :ref:`unsupported_c_features` below.
ESP-IDF is primarily written in C and provides C APIs. ESP-IDF uses `Newlib <https://sourceware.org/newlib/>`_ as its C Standard Library implementation (the Newlib version is specified in :component_file:`newlib/sbom.yml`). In general, all C features that are supported by the compiler (currently GCC) can be used in ESP-IDF, unless specified in :ref:`unsupported_c_features` below.
.. _c_version:
@@ -33,4 +31,4 @@ The following features are not supported in ESP-IDF.
Nested Function Pointers
^^^^^^^^^^^^^^^^^^^^^^^^
The **GNU dialect of ISO C17** supports `nested functions <https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html>`_. However, they do not work in ESP-IDF when referenced as function pointer because the compiler generates a trampoline on the stack, while the stack is not executable in ESP-IDF. Hence, do not use function pointers to nested functions.
The **GNU dialect of ISO C17** supports `nested functions <https://gcc.gnu.org/onlinedocs/gcc/Nested-Functions.html>`_. However, ESP-IDF does not support referencing nested functions as pointers. This is due to the fact that the GCC compiler generates a `trampoline <https://gcc.gnu.org/onlinedocs/gccint/Trampolines.html>`_ (i.e., small piece of executable code) on the stack when a pointer to a nested function is referenced. ESP-IDF does not permit executing code from a stack, thus use of pointers to nested functions is not supported.