IBM Power Connect, learn, share, and engage with IBMPower. Join / Log in
Originally posted by: RoyHu
Benefit: The _Noreturn keyword enables optimizers to produce faster code by ignoring what would happen if the function returns.
Usage: A function declared with the _Noreturn specifier indicates that this function will not return the control to its caller.
You can use the _Noreturn specifier to declare or define any functions other than the main function. It is undefined behavior if such function actually returns.
However, any functions that are declared with _Noreturn must call one of the following functions. Otherwise, the functions will return the control to their respective caller. • abort • exit • _Exit • longjmp • quick_exit • thrd_exit
Example: _Noreturn void good () { abort(); // okay }
_Noreturn void bad (int i) { if (i > 0) abort(); // causes undefined behavior if i <= 0 }
How to enable this feature: You can enable this feature with the -qlanglvl=extc1x option.
Related information: • The _Noreturn function specifier: http://pic.dhe.ibm.com/infocenter/comphelp/v121v141/topic/com.ibm.xlc121.aix.doc/language_ref/noreturn.html
• Keywords: http://pic.dhe.ibm.com/infocenter/comphelp/v121v141/topic/com.ibm.xlcpp121.aix.doc/language_ref/keyw.html
• Extensions for C1X compatibility http://pic.dhe.ibm.com/infocenter/comphelp/v121v141/topic/com.ibm.xlc121.aix.doc/language_ref/c1x_ext.html
Originally posted by: RajanB
Originally posted by: PeeterJoot