zephyr/doc/develop/languages/cpp_language.rst
Stephanos Ioannidis c45a2213c6 doc: develop: Add 'Language Support' sub-category
This commit adds the 'Language Support' sub-category under the
'Developing with Zephyr' category with programming language support-
related documentations.

The contents of the 'C standard library' page have been relocated to
the 'C Language Support' page, and the contents of the 'C++ Support for
Applications' page have been relocated to the 'C++ Language Support'
page.

Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
2022-06-01 15:26:48 +02:00

39 lines
1.3 KiB
ReStructuredText

.. _language_cpp:
C++ Language Support
####################
C++ is a general-purpose object-oriented programming language that is based on
the C language.
Zephyr supports applications written in both C and C++. However, to
use C++ in an application you must configure the kernel to include C++
support and the build system must select the correct compiler.
The build system selects the C++ compiler based on the suffix of the files.
Files identified with either a **cxx** or a **cpp** suffix are compiled using
the C++ compiler. For example, :file:`myCplusplusApp.cpp` is compiled using C++.
The kernel currently provides only a subset of C++ functionality. The
following features are *not* supported:
* Dynamic object management with the **new** and **delete** operators
* :abbr:`RTTI (runtime type information)`
* Static global object destruction
While not an exhaustive list, support for the following functionality is
included:
* Inheritance
* Virtual functions
* Virtual tables
* Static global object constructors
* Exceptions
Static global object constructors are initialized after the drivers are
initialized but before the application :c:func:`main()` function. Therefore,
use of C++ is restricted to application code.
.. note::
Do not use C++ for kernel, driver, or system initialization code.