docs(cxx): add a section about std::filesystem limitations

Co-authored-by: Shen Meng Jing <shenmengjing@espressif.com>
This commit is contained in:
Ivan Grokhotkov 2024-10-29 12:40:22 +01:00
parent 2ca6d2d4b4
commit b2137e5e70
No known key found for this signature in database
GPG Key ID: 1E050E141B280628
2 changed files with 32 additions and 0 deletions

View File

@ -13,6 +13,7 @@ The following C++ features are supported:
- :ref:`cplusplus_multithreading`
- :ref:`cplusplus_rtti`
- :doc:`thread-local-storage` (``thread_local`` keyword)
- :ref:`cplusplus_filesystem`
- All C++ features implemented by GCC, except for some :ref:`cplusplus_limitations`. See `GCC documentation <https://gcc.gnu.org/projects/cxx-status.html>`_ for details on features implemented by GCC.
@ -94,6 +95,21 @@ Enabling this option compiles all C++ files with RTTI support enabled, which all
See :example:`cxx/rtti` for an example of using RTTI in ESP-IDF. Specifically, this example demonstrates how to use the RTTI feature in ESP-IDF, enabling compile time support for RTTI, and showing how to print demangled type names of objects and functions, and how dynamic_cast behaves with objects of two classes derived from a common base class.
.. _cplusplus_filesystem:
Filesystem Library
------------------
C++ Filesystem library (``#include <filesystem>``) features are supported in ESP-IDF, with the following exceptions:
- Since symbolic and hard links are not supported in ESP-IDF, related functions are not implemented.
- ``std::filesystem::space`` is not implemented.
- ``std::filesystem::resize_file`` is not implemented.
- ``std::filesystem::current_path`` always returns ``/``. Setting the current path is not supported.
- ``std::filesystem::permissions`` doesn't support setting file permissions.
Note that the choice of the filesystem also affects the behavior of the filesystem library. For example, SPIFFS filesystem has limited support for directories, therefore the related std::filesystem functions may not work as they do on a filesystem which does support directories.
Developing in C++
-----------------

View File

@ -13,6 +13,7 @@ ESP-IDF 支持以下 C++ 功能:
- :ref:`cplusplus_multithreading`
- :ref:`cplusplus_rtti`
- :doc:`thread-local-storage` ``thread_local`` 关键字)
- :ref:`cplusplus_filesystem`
- 除部分 :ref:`cplusplus_limitations`,所有由 GCC 实现的 C++ 功能均受支持。有关由 GCC 所实现功能的详细信息,请参阅 `GCC 文档 <https://gcc.gnu.org/projects/cxx-status.html>`_
@ -94,6 +95,21 @@ ESP-IDF 默认禁用对 RTTI 的支持,可以用 :ref:`CONFIG_COMPILER_CXX_RTT
有关在 ESP-IDF 中使用 RTTI 的示例,请参阅 :example:`cxx/rtti`。该示例演示了如何在 ESP-IDF 中使用 RTTI 功能,启用编译时对 RTTI 的支持,并展示了如何打印对象和函数的去混淆类型名称,以及 dynamic_cast 在两个继承自同一基类的对象上如何表现。
.. _cplusplus_filesystem:
文件系统库
----------
ESP-IDF 支持 C++ 文件系统库 (``#include <filesystem>``),但有部分功能尚未实现:
- 由于 ESP-IDF 不支持符号链接和硬链接,因此相关函数未实现。
- 未实现 ``std::filesystem::space``
- 未实现 ``std::filesystem::resize_file``
- ``std::filesystem::current_path`` 只返回 ``/``。不支持设置当前路径。
- ``std::filesystem::permissions`` 不支持设置文件权限。
请注意文件系统的选择也会影响文件系统库的行为。例如SPIFFS 文件系统对目录的支持有限,因此相关的 std::filesystem 函数可能无法像在支持目录的文件系统上那样正常工作。
在 C++ 中进行开发
-----------------