CKTIS / C
_Noreturn — a function that does not return to its caller
_Noreturn marks a function that never returns to its caller. C23 retains it as an obsolescent feature; prefer [[noreturn]].
Version: C23; repository compiler flag, production runtime not attested
Syntax
_Noreturn void finish(void);_Noreturn is a function specifier promising no return to the caller. It needs no header. Plain void means no returned value, not no return.
Returning through return; or reaching the function's closing brace causes undefined behavior. The specifier does not terminate execution automatically; the example explicitly calls exit(EXIT_SUCCESS).
In C23, _Noreturn is obsolescent but remains available. Prefer the [[noreturn]] attribute in new code.
Examples
#include <stdio.h>
#include <stdlib.h>
_Noreturn void finish(void)
{
puts("done");
exit(EXIT_SUCCESS);
}
int main(void)
{
finish();
}
Result
done
The displayed code and declared result were verified in an isolated environment using the method recorded in the verification evidence for this exact version.