From WikiChip
noreturn macro - <stdnoreturn.h> - C
< c‎ | stdnoreturn.h
Revision as of 22:17, 13 December 2013 by Inject (talk | contribs) (Created page with "{{DISPLAYTITLE: noreturn macro - <stdnoreturn.h> - C}} {{Stdnoreturn.h - C}} The '''noreturn''' macro, which is part of <stdnoreturn.h>, expands to the [...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

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