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

(Created page with "{{DISPLAYTITLE: noreturn macro - <stdnoreturn.h> - C}} {{Stdnoreturn.h - C}} The '''noreturn''' macro, which is part of <stdnoreturn.h>, expands to the [...")
 
m
 
(3 intermediate revisions by 2 users not shown)
Line 1: Line 1:
 
{{DISPLAYTITLE: noreturn macro - <stdnoreturn.h> - C}}
 
{{DISPLAYTITLE: noreturn macro - <stdnoreturn.h> - C}}
 
{{Stdnoreturn.h - C}}
 
{{Stdnoreturn.h - C}}
The '''noreturn''' macro, which is part of [[stdnoreturn.h - C|<stdnoreturn.h>]], expands to the [[_Noreturn - C|_Noreturn]] [[Reserved keywords - C|keyword]].
+
The '''noreturn''' macro, which is part of {{c|stdnoreturn.h|<stdnoreturn.h>}}, expands to the {{c|_Noreturn}} {{c|keyword}}.
  
 
== Synopsis ==
 
== Synopsis ==
Line 10: Line 10:
  
 
== Description ==
 
== Description ==
The noreturn object-like macro expands to the [[_Noreturn - C|_Noreturn]], a keyword added in [[C11]] to mark non-returning functions.
+
The noreturn object-like macro expands to the {{c|_Noreturn}}, a keyword added in [[C11]] to mark non-returning functions.
  
 
== Example ==
 
== Example ==
Line 18: Line 18:
 
#include <stdnoreturn.h>
 
#include <stdnoreturn.h>
  
_Noreturn void fatal()
+
noreturn void fatal()
 
{
 
{
 
     fprintf(stderr, "Program encountered an unrecoverable error\n");
 
     fprintf(stderr, "Program encountered an unrecoverable error\n");
Line 27: Line 27:
 
== See also ==
 
== See also ==
 
* [[C Standard Library]]
 
* [[C Standard Library]]
 +
 +
[[Category:C programming language]]

Latest revision as of 14:54, 23 November 2015

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

Synopsis[edit]

#include <stdnoreturn.h>
#define noreturn _Noreturn

Description[edit]

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

Example[edit]

#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[edit]