diff --git a/docs/en/api-guides/cplusplus.rst b/docs/en/api-guides/cplusplus.rst index 44986620a1..6c94e0697c 100644 --- a/docs/en/api-guides/cplusplus.rst +++ b/docs/en/api-guides/cplusplus.rst @@ -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 `_ 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 ``) 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++ ----------------- diff --git a/docs/zh_CN/api-guides/cplusplus.rst b/docs/zh_CN/api-guides/cplusplus.rst index 7d7e38b81c..9de18fb674 100644 --- a/docs/zh_CN/api-guides/cplusplus.rst +++ b/docs/zh_CN/api-guides/cplusplus.rst @@ -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 文档 `_。 @@ -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 ``),但有部分功能尚未实现: + +- 由于 ESP-IDF 不支持符号链接和硬链接,因此相关函数未实现。 +- 未实现 ``std::filesystem::space``。 +- 未实现 ``std::filesystem::resize_file``。 +- ``std::filesystem::current_path`` 只返回 ``/``。不支持设置当前路径。 +- ``std::filesystem::permissions`` 不支持设置文件权限。 + +请注意,文件系统的选择也会影响文件系统库的行为。例如,SPIFFS 文件系统对目录的支持有限,因此相关的 std::filesystem 函数可能无法像在支持目录的文件系统上那样正常工作。 + 在 C++ 中进行开发 -----------------