[support.runtime] (original) (raw)

17 Language support library [support]

17.14 Other runtime support [support.runtime]


17.14.1 General [support.runtime.general]

17.14.2 Header synopsis [cstdarg.syn]

17.14.3 Header synopsis [csetjmp.syn]

17.14.4 Header synopsis [csignal.syn]

17.14.5 Signal handlers [support.signal]


17.14.1 General [support.runtime.general]

Headers (nonlocal jumps), (signal handling), (variable arguments), and (runtime environment getenv, system), provide further compatibility with C code.

Calls to the functiongetenv ([cstdlib.syn]) shall not introduce a data race ([res.on.data.races]) provided that nothing modifies the environment.

[Note 1:

Calls to the POSIX functionssetenv andputenv modify the environment.

— _end note_]

A call to the setlocale function may introduce a data race with other calls to the setlocale function or with calls to functions that are affected by the current C locale.

The implementation shall behave as if no library function other than locale​::​global calls the setlocalefunction.

17.14.2 Header synopsis [cstdarg.syn]

The contents of the header are the same as the C standard library header , with the following changes:

See also: ISO/IEC 9899:2024, 7.16

17.14.3 Header synopsis [csetjmp.syn]

#define __STDC_VERSION_SETJMP_H__ 202311L namespace std { using jmp_buf = see below;[[noreturn]] void longjmp(jmp_buf env, int val);} #define setjmp(env) see below

The contents of the header are the same as the C standard library header .

The function signaturelongjmp(jmp_buf jbuf, int val)has more restricted behavior in this document.

A setjmp/longjmp call pair has undefined behavior if replacing the setjmp and longjmpby catch and throw would invoke any non-trivial destructors for any objects with automatic storage duration.

A call to setjmp or longjmp has undefined behavior if invoked in a suspension context of a coroutine ([expr.await]).

See also: ISO/IEC 9899:2024, 7.13

17.14.4 Header synopsis [csignal.syn]

namespace std { using sig_atomic_t = see below;extern "C" using signal-handler = void(int); signal-handler* signal(int sig, signal-handler* func);int raise(int sig);} #define SIG_DFL see below #define SIG_ERR see below #define SIG_IGN see below #define SIGABRT see below #define SIGFPE see below #define SIGILL see below #define SIGINT see below #define SIGSEGV see below #define SIGTERM see below

The contents of the header are the same as the C standard library header .

17.14.5 Signal handlers [support.signal]

A call to the function signal synchronizes with any resulting invocation of the signal handler so installed.

A plain lock-free atomic operation is an invocation of a function f from [atomics], such that:

An evaluation is signal-safe unless it includes one of the following:

A signal handler invocation has undefined behavior if it includes an evaluation that is not signal-safe.

The function signal is signal-safe if it is invoked with the first argument equal to the signal number corresponding to the signal that caused the invocation of the handler.

See also: ISO/IEC 9899:2024, 7.14