Init
This commit is contained in:
33
cppdraft/cstdlib/syn.md
Normal file
33
cppdraft/cstdlib/syn.md
Normal file
@@ -0,0 +1,33 @@
|
||||
[cstdlib.syn]
|
||||
|
||||
# 17 Language support library [[support]](./#support)
|
||||
|
||||
## 17.2 Common definitions [[support.types]](support.types#cstdlib.syn)
|
||||
|
||||
### 17.2.2 Header <cstdlib> synopsis [cstdlib.syn]
|
||||
|
||||
[ð](#header:%3ccstdlib%3e)
|
||||
|
||||
namespace std {using size_t = *see below*; // freestandingusing div_t = *see below*; // freestandingusing ldiv_t = *see below*; // freestandingusing lldiv_t = *see below*; // freestanding}#define [NULL](cstdio.syn#lib:NULL "31.13.1 Header <cstdio> synopsis [cstdio.syn]") *see below* // freestanding#define [EXIT_FAILURE](#lib:EXIT_FAILURE "17.2.2 Header <cstdlib> synopsis [cstdlib.syn]") *see below* // freestanding#define [EXIT_SUCCESS](#lib:EXIT_SUCCESS "17.2.2 Header <cstdlib> synopsis [cstdlib.syn]") *see below* // freestanding#define [RAND_MAX](#lib:RAND_MAX "17.2.2 Header <cstdlib> synopsis [cstdlib.syn]") *see below*#define [MB_CUR_MAX](#lib:MB_CUR_MAX "17.2.2 Header <cstdlib> synopsis [cstdlib.syn]") *see below*namespace std {// Exposition-only function type aliasesextern "C" using *c-atexit-handler* = void(); // *exposition only*extern "C++" using *atexit-handler* = void(); // *exposition only*extern "C" using *c-compare-pred* = int(const void*, const void*); // *exposition only*extern "C++" using *compare-pred* = int(const void*, const void*); // *exposition only*// [[support.start.term]](support.start.term "17.5 Startup and termination"), start and termination[[noreturn]] void abort() noexcept; // freestandingint atexit(*c-atexit-handler** func) noexcept; // freestandingint atexit(*atexit-handler** func) noexcept; // freestandingint at_quick_exit(*c-atexit-handler** func) noexcept; // freestandingint at_quick_exit(*atexit-handler** func) noexcept; // freestanding[[noreturn]] void exit(int status); // freestanding[[noreturn]] void _Exit(int status) noexcept; // freestanding[[noreturn]] void quick_exit(int status) noexcept; // freestandingchar* [getenv](support.runtime.general#lib:getenv "17.14.1 General [support.runtime.general]")(const char* name); int system(const char* string); // [[c.malloc]](c.malloc "20.2.12 C library memory allocation"), C library memory allocationvoid* aligned_alloc(size_t alignment, size_t size); void* calloc(size_t nmemb, size_t size); void free(void* ptr); void free_sized(void* ptr, size_t size); void free_aligned_sized(void* ptr, size_t alignment, size_t size); void* malloc(size_t size); void* realloc(void* ptr, size_t size);
|
||||
size_t memalignment(const void* p); // freestandingdouble atof(const char* nptr); int atoi(const char* nptr); long int atol(const char* nptr); long long int atoll(const char* nptr); double strtod(const char* nptr, char** endptr); int strfromd(char* s, size_t n, const char* format, double fp); int strfromf(char* s, size_t n, const char* format, float fp); int strfroml(char* s, size_t n, const char* format, long double fp); float strtof(const char* nptr, char** endptr); long double strtold(const char* nptr, char** endptr); long int strtol(const char* nptr, char** endptr, int base); long long int strtoll(const char* nptr, char** endptr, int base); unsigned long int strtoul(const char* nptr, char** endptr, int base); unsigned long long int strtoull(const char* nptr, char** endptr, int base); // [[c.mb.wcs]](c.mb.wcs "28.7.5 Multibyte / wide string and character conversion functions"), multibyte / wide string and character conversion functionsint mblen(const char* s, size_t n); int mbtowc(wchar_t* pwc, const char* s, size_t n); int wctomb(char* s, wchar_t wchar);
|
||||
size_t mbstowcs(wchar_t* pwcs, const char* s, size_t n);
|
||||
size_t wcstombs(char* s, const wchar_t* pwcs, size_t n); // [[alg.c.library]](alg.c.library "26.13 C library algorithms"), C standard library algorithmsvoid* bsearch(const void* key, void* base, size_t nmemb, size_t size, // freestanding*c-compare-pred** compar); void* bsearch(const void* key, void* base, size_t nmemb, size_t size, // freestanding*compare-pred** compar); const void* bsearch(const void* key, const void* base, size_t nmemb, // freestanding size_t size, *c-compare-pred** compar); const void* bsearch(const void* key, const void* base, size_t nmemb, // freestanding size_t size, *compare-pred** compar); void qsort(void* base, size_t nmemb, size_t size, *c-compare-pred** compar); // freestandingvoid qsort(void* base, size_t nmemb, size_t size, *compare-pred** compar); // freestanding// [[c.math.rand]](c.math.rand "29.5.10 Low-quality random number generation"), low-quality random number generationint rand(); void srand(unsigned int seed); // [[c.math.abs]](c.math.abs "29.7.2 Absolute values"), absolute valuesconstexpr int abs(int j); // freestandingconstexpr long int abs(long int j); // freestandingconstexpr long long int abs(long long int j); // freestandingconstexpr *floating-point-type* abs(*floating-point-type* j); // freestanding-deletedconstexpr long int labs(long int j); // freestandingconstexpr long long int llabs(long long int j); // freestandingconstexpr div_t div(int numer, int denom); // freestandingconstexpr ldiv_t div(long int numer, long int denom); // freestanding; see [[library.c]](library.c "16.2 The C standard library")constexpr lldiv_t div(long long int numer, long long int denom); // freestanding; see [[library.c]](library.c "16.2 The C standard library")constexpr ldiv_t ldiv(long int numer, long int denom); // freestandingconstexpr lldiv_t lldiv(long long int numer, long long int denom); // freestanding}
|
||||
|
||||
[1](#1)
|
||||
|
||||
[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/support.tex#L239)
|
||||
|
||||
The contents and meaning of the header [<cstdlib>](#header:%3ccstdlib%3e "17.2.2 Header <cstdlib> synopsis [cstdlib.syn]") are the same as
|
||||
the C standard library header [<stdlib.h>](support.c.headers.general#header:%3cstdlib.h%3e "17.15.1 General [support.c.headers.general]"),
|
||||
except that it does not declare the types wchar_t or once_flag,
|
||||
and does not declare the function call_once,
|
||||
and except as noted in[[support.types.nullptr]](support.types.nullptr "17.2.3 Null pointers"),[[support.types.layout]](support.types.layout "17.2.4 Sizes, alignments, and offsets"),[[support.start.term]](support.start.term "17.5 Startup and termination"),[[c.malloc]](c.malloc "20.2.12 C library memory allocation"),[[c.mb.wcs]](c.mb.wcs "28.7.5 Multibyte / wide string and character conversion functions"),[[alg.c.library]](alg.c.library "26.13 C library algorithms"),[[c.math.rand]](c.math.rand "29.5.10 Low-quality random number generation"), and[[c.math.abs]](c.math.abs "29.7.2 Absolute values")[.](#1.sentence-1)
|
||||
|
||||
[*Note [1](#note-1)*:
|
||||
|
||||
Several functions have additional overloads in this document,
|
||||
but they have the same behavior as in the [C standard library](library.c "16.2 The C standard library [library.c]")[.](#1.sentence-2)
|
||||
|
||||
â *end note*]
|
||||
|
||||
See also: ISO/IEC 9899:2024, 7.24
|
||||
Reference in New Issue
Block a user