You need a book familiar with C11 (ISO/IEC 9899:2011). The keyword _Noreturn
is a new function specifier, like inline
(which was added in C99 or ISO/IEC 9899:1999). It is not a type (or absence of type) as with void
. _Noreturn
means that the function does not return. For example, the C11 standard declares that exit()
is a function that does not return:
#include <stdlib.h>
_Noreturn void exit(int status);
There's also a header, <stdnoreturn.h>
, that provides
#define noreturn _Noreturn
Note that the name _Noreturn
is from the namespace reserved for the implementation; the name noreturn
could have been used by a user. Any code broken by _Noreturn
was already abusing the namespace reserved for the implementation.
You'll also find older code using compiler-specific mechanisms, such as __attribute__((noreturn))
in GCC.
In general, function specifiers identify properties about a function that are not directly the type of the function. For example, inline
has implications that the function may be suitable for inlining — it is a hint to the compiler/optimizer. Similarly, _Noreturn
is a hint to the compiler/optimizer that if the function is called, control will never return to the calling code.