From dcadd30f453f9301e75b3d1a2b2e6c0afdc1aba2 Mon Sep 17 00:00:00 2001 From: Jennifer Marandola Date: Mon, 22 Feb 2016 13:37:16 -0500 Subject: [PATCH] doc: Doc updates for C++ feature with updates from code review. Updated note text based on code review. Change-Id: I0f32c5821b37062d23ddbf2252ae8b3d4c8739b5 Signed-off-by: Jennifer Marandola --- doc/kernel/overview/kernel_fundamentals.rst | 34 +++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/doc/kernel/overview/kernel_fundamentals.rst b/doc/kernel/overview/kernel_fundamentals.rst index 82be902e615..1df354db485 100644 --- a/doc/kernel/overview/kernel_fundamentals.rst +++ b/doc/kernel/overview/kernel_fundamentals.rst @@ -340,6 +340,40 @@ Applications that require a more extensive C library can either submit contributions that enhance the existing library or substitute a replacement library. +C++ Support for Applications +**************************** + +The Zephyr kernel supports applications written in both C and C++. However, to +use C++ in an application, you must configure your 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`. + +The Zephyr 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 (run-time type information)` +* Exceptions +* 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 + +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. + Device Driver Library *********************