On this page
  1. _Noreturn
  2. Availability
  3. Syntax & Overview
  4. Notes & Pitfalls
  5. Example

_Noreturn

Prev: _Static_assert | Up: builtins | Next: void
Rel: exit(), abort()
Ref: cppreference — _Noreturn
Tags: #public #prog #c #builtins #tier/specialized


Availability

Built-in (Function Specifier (C11; [[noreturn]] in C23)) — requires no #include header.

Syntax & Overview

_Noreturn void fatal(const char *msg);

Informs the compiler that a function never returns to its caller (e.g., calls exit() or abort()).

Notes & Pitfalls

Example

#include <stdlib.h>

_Noreturn void die(int code) {
    exit(code);
}

Linked from

Related notes