doc/releases: Note "main" return type change for 3.4

Add a paragraph explaining the change from void main(void) to int
main(void) and the requirement for main functions to return zero.

Signed-off-by: Keith Packard <keithp@keithp.com>
This commit is contained in:
Keith Packard 2023-04-05 09:14:10 -07:00 committed by Stephanos Ioannidis
commit 7d4a7d79a8
2 changed files with 13 additions and 2 deletions

View file

@ -129,6 +129,17 @@ Changes in this release
* Touchscreen drivers converted to use the input APIs can use the * Touchscreen drivers converted to use the input APIs can use the
:dtcompatible:`zephyr,kscan-input` driver to maintain Kscan compatilibity. :dtcompatible:`zephyr,kscan-input` driver to maintain Kscan compatilibity.
* The declaration of :c:func:`main` has been changed from ``void
main(void)`` to ``int main(void)``. The main function is required to
return the value zero. All other return values are reserved. This aligns
Zephyr with the C and C++ language specification requirements for
"hosted" environments, avoiding compiler warnings and errors. These
compiler messages are generated when applications are built in "hosted"
mode (which means without the ``-ffreestanding`` compiler flag). As the
``-ffreestanding`` flag is currently enabled unless the application is
using picolibc, only applications using picolibc will be affected by this
change at this time.
Removed APIs in this release Removed APIs in this release
============================ ============================

View file

@ -6,8 +6,8 @@
#include <zephyr/kernel.h> #include <zephyr/kernel.h>
int main(void) void main(void)
{ {
printk("Hello World! %s\n", CONFIG_BOARD); printk("Hello World! %s\n", CONFIG_BOARD);
return 0; return;
} }