cstdlib
这个标头最初在C标准库中作为<stdlib.h>
...
此标头提供杂项实用程序。这里定义的符号由几个库组件使用。
宏常数
EXIT_SUCCESSEXIT_FAILURE | indicates program execution execution status (macro constant) |
---|---|
MB_CUR_MAX | maximum number of bytes in a multibyte character with the current locale (macro constant) |
NULL | implementation-defined null pointer constant (macro constant) |
RAND_MAX | maximum possible value generated by std::rand (macro constant) |
类型
div_t | structure type, return of the std::div function (typedef) |
---|---|
ldiv_t | structure type, return of the std::ldiv function (typedef) |
lldiv_t (C++11) | structure type, return of the std::lldiv function (typedef) |
size_t | unsigned integer type returned by the sizeof operator (typedef) |
功能
过程控制
*。
中止导致异常程序终止%28而不清理%29%28功能%29
退出导致正常程序终止,清除%28功能%29
速战速决[医]退出%28C++11%29导致快速程序终止,而不完全清除%28功能%29
[医]退出%28C++11%29导致正常程序终止而不清理%28功能%29
ATExit注册一个在std上调用的函数::Exit%28%29调用%28 Function%29
在[医]速战速决[医]退出%28C++11%29注册一个要快速调用的函数[医]退出调用%28功能%29
系统调用主机环境%27s命令处理器%28功能%29
getenv访问环境变量列表%28函数%29
内存管理
malloc分配内存%28功能%29
对齐[医]alloc%28C++17%29分配对齐内存%28功能%29
calloc分配和零内存%28功能%29
realloc扩展以前分配的内存块%28功能%29
释放先前分配的内存%28函数%29
数字字符串转换
atof将字节字符串转换为浮点值%28函数%29
将字节字符串转换为整数值%28函数%29
将字节字符串转换为整数值%28函数%29
strtoul strtoull将字节字符串转换为无符号整数值%28函数%29
strtofstrtodstrted将字节字符串转换为浮点值%28函数%29
宽字符串操作
mblen返回下一个多字节字符%28函数%29中的字节数
MBTowc将下一个多字节字符转换为宽字符%28功能%29
将宽字符转换为其多字节表示形式%28功能%29
mbstowcs将窄多字节字符串转换为宽字符串%28功能%29
将宽字符串转换为窄多字节字符串%28函数%29
杂乱的算法和数学
Rand生成伪随机数%28函数%29。
种子伪随机数发生器%28函数%29
QSort对未指定类型%28函数%29的元素范围进行排序
BSearch在数组中搜索未指定类型%28函数%29的元素
ABS%28int%29 labsllabs%28C++11%29计算积分值%28的绝对值X%29%28功能%29
div%28int%29ldivlldiv%28C++11%29计算商数和整数除法的余数%28函数%29
简介
二次
namespace std {
using size_t = /*see description*/ ;
using div_t = /*see description*/ ;
using ldiv_t = /*see description*/ ;
using lldiv_t = /*see description*/ ;
}
#define NULL /*see description*/
#define EXIT_FAILURE /*see description*/
#define EXIT_SUCCESS /*see description*/
#define RAND_MAX /*see description*/
#define MB_CUR_MAX /*see description*/
namespace std {
// Exposition-only function type aliases
extern "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
// start and termination
[[noreturn]] void abort() noexcept;
int atexit(/*c-atexit-handler*/ * func) noexcept;
int atexit(/*atexit-handler*/ * func) noexcept;
int at_quick_exit(/*c-atexit-handler*/ * func) noexcept;
int at_quick_exit(/*atexit-handler*/ * func) noexcept;
[[noreturn]] void exit(int status);
[[noreturn]] void _Exit(int status) noexcept;
[[noreturn]] void quick_exit(int status) noexcept;
char* getenv(const char* name);
int system(const char* string);
// C library memory allocation
void* aligned_alloc(size_t alignment, size_t size);
void* calloc(size_t nmemb, size_t size);
void free(void* ptr);
void* malloc(size_t size);
void* realloc(void* ptr, size_t size);
double 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);
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);
// multibyte / wide string and character conversion functions
int 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);
// C standard library algorithms
void* bsearch(const void* key, const void* base,
size_t nmemb, size_t size, /*c-compare-pred*/ * compar);
void* bsearch(const void* key, const void* base,
size_t nmemb, size_t size, /*compare-pred*/ * compar);
void qsort(void* base, size_t nmemb, size_t size, /*c-compare-pred*/ * compar);
void qsort(void* base, size_t nmemb, size_t size, /*compare-pred*/ * compar);
// low-quality random number generation
int rand();
void srand(unsigned int seed);
// absolute values
int abs(int j);
long int abs(long int j);
long long int abs(long long int j);
float abs(float j);
double abs(double j);
long double abs(long double j);
long int labs(long int j);
long long int llabs(long long int j);
div_t div(int numer, int denom);
ldiv_t div(long int numer, long int denom);
lldiv_t div(long long int numer, long long int denom);
ldiv_t ldiv(long int numer, long int denom);
lldiv_t lldiv(long long int numer, long long int denom);
}
二次
另见
- 程序支持实用程序
- 伪随机数生成
- 公共数学函数
- C内存管理库
- 空终止字节字符串
- 空终止多字节字符串
- 算法库
? cppreference.com
在CreativeCommonsAttribution下授权-ShareAlike未移植许可v3.0。
本文档系腾讯云开发者社区成员共同维护,如有问题请联系 cloudcommunity@tencent.com