From WikiChip
Difference between revisions of "c/stdnoreturn.h/noreturn"
(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 | + | 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 | + | 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() | |
{ | { | ||
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 13:54, 23 November 2015
The noreturn macro, which is part of <stdnoreturn.h>, expands to the _Noreturn keyword.
Contents
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);
}