From WikiChip
Difference between revisions of "c/stdnoreturn.h/noreturn"
< c‎ | stdnoreturn.h

m (Example)
Line 27: Line 27:
 
== See also ==
 
== See also ==
 
* [[C Standard Library]]
 
* [[C Standard Library]]
 +
 +
[[Category:C programming language]]

Revision as of 05:14, 15 February 2014

The noreturn macro, which is part of <stdnoreturn.h>, expands to the _Noreturn keyword.

Synopsis

#include <stdnoreturn.h>
#define noreturn _Noreturn

Description

The noreturn object-like macro expands to the _Noreturn, a keyword added in C11 to mark non-returning functions.

Example

#include <stdlib.h>
#include <stdio.h>
#include <stdnoreturn.h>

noreturn void fatal()
{
    fprintf(stderr, "Program encountered an unrecoverable error\n");
    exit(EXIT_FAILURE);
}

See also