doc: languages: cpp: Add notes about C++ main()
This commit adds notes about the C++ main() function prototype in the C++ documentation. Signed-off-by: Stephanos Ioannidis <stephanos.ioannidis@nordicsemi.no>
This commit is contained in:
parent
ae0437d2df
commit
8073115b4c
1 changed files with 6 additions and 0 deletions
|
@ -24,6 +24,12 @@ on the suffix (extension) of the files. Files identified with either a **cpp**
|
|||
or a **cxx** suffix are compiled using the C++ compiler. For example,
|
||||
:file:`myCplusplusApp.cpp` is compiled using C++.
|
||||
|
||||
The C++ standard requires the ``main()`` function to have the return type of
|
||||
``int`` while Zephyr uses ``void`` by default. If your ``main()`` is defined in
|
||||
a C++ source file, you must select :kconfig:option:`CONFIG_CPP_MAIN` in the
|
||||
application configuration file so that Zephyr uses ``int main(void)`` instead
|
||||
of ``void main(void)``.
|
||||
|
||||
.. note::
|
||||
Do not use C++ for kernel, driver, or system initialization code.
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue