是否有描述 C 函数名称 "stand for" 的文档(不是它们的作用——而是缩写名称的含义)?
Is there documentation that describes what C function names "stand for" (not what they do--rather, what the abreviated name means)?
有时我很难理解 C 函数名称的含义。例如:函数 sigprocmask
改变了阻塞信号的集合,但我不知道缩写 procmask
是什么意思。 linux man page 描述了函数的行为,但没有提到缩写。
另一个例子是常量SIGWINCH
。我知道这是一个 window 大小发生变化的信号,但是明确说明“SIGWINCH
= Signal Window Changed。” 有人知道这样的资源吗?我看过几个,他们都描述了行为,但忽略了缩写。谢谢!
我记得在我学习C的早期,知道函数缩写代表什么对我帮助很大。所以这是揭开缩写神秘面纱的尝试。
这个post关注的是缩写,而不是意思。因此需要提出一些要点:
一些缩写本身没有意义。要么是因为有些单词是隐含的,要么是因为展开缩写时字母顺序很奇怪。例如 iswprint
是 "is wide printing" 的缩写。意思是"wide character is printing character"
一些缩写具有误导性。例如。 SIGFPE
中的 FPE
代表 "Floating Point Exception",但该类别用于算术异常。例如。 qsort
代表 "quick sort" 但标准不需要此算法,它通常实现为多态排序。
标准库
结构如下https://en.cppreference.com/w/c
类型支持
| abbrev | stands for |
| ----------- | ----------------------- |
| site_t | size type |
| ptrdiff_t | pointer difference type |
| NULL | null |
| max_align_t | max align type |
| offsetof | offset of |
| alignas | align as |
| alignof | align of |
| noreturn | no return |
程序支持实用程序
程序终止
| abbrev | stands for |
| ------------- | ------------- |
| abort | abort |
| exit | exit |
| quick_exit | quick_exit |
| _Exit | exit |
| atexit | at exit |
| at_quick_exit | at quick exit |
与环境交流
| abbrev | stands for |
| -------- | -------------------------------- |
| system | system |
| getenv | get environment (variables) |
| getenv_s | get environment (variables) safe |
信号
| abbrev | stands for |
| ------------ | ------------------ |
| signal | signal |
| raise | raise |
| sig_atomic_t | signal atomic type |
| SIG_DFL | signal default |
| SIG_IGN | signal ignore |
| SIG_ERR | signal error |
信号类型
| abbrev | stands for |
| ------- | ------------------------------- |
| SIGTERM | signal termination |
| SIGSEGV | signal segmentation violation |
| SIGINT | signal interrupt |
| SIGILL | signal illegal instruction |
| SIGABRT | signal abnormal termination |
| SIGFPE | signal floating point exception |
非本地跳转
| abbrev | stands for |
| ------- | ---------- |
| setjmp | set jump |
| longjmp | long jump |
类型
| abbrev | stands for |
| ------- | ----------- |
| jmp_buf | jump buffer |
可变函数
| abbrev | stands for |
| -------- | ------------------------ |
| va_start | variable arguments start |
| va_end | variable arguments end |
| va_copy | variable arguments copy |
| va_end | variable arguments end |
| va_list | variable arguments list |
内存管理
| abbrev | stands for |
| ------------- | ------------------------------- |
| malloc | memory allocate |
| calloc | (unknown origin for c) allocate |
| realloc | reallocate |
| free | free |
| aligned_alloc | aligned allocate |
日期和时间实用程序
待办事项
字符串库
空终止字节字符串
人物分类
| abbrev | stands for |
| -------- | --------------- |
| isalnum | is alphanumeric |
| isalpha | is alphabetic |
| islower | is lowercase |
| isupper | is uppercase |
| isdigit | is digit |
| isxdigit | is hexadecimal |
| iscntrl | is control |
| isgraph | is graphical |
| isspace | is space |
| isblang | is blank |
| isprint | is printing |
| ispunct | is punctuation |
字符操纵
| abbrev | stands for |
| ------- | ------------ |
| tolower | to lowercase |
| toupper | to uppercase |
转换为数字格式
| abbrev | stands for |
| --------- | ---------------------------- |
| atof | ascii to floating-point |
| atol | ascii to long |
| atoll | ascii to long long |
| strtol | string to long |
| strtoll | string to long long |
| strtoul | string to unsigned long |
| strtoull | string to unsigned long long |
| strtof | string to float |
| strtod | string to double |
| strotold | string to long double |
| strtoimax | string to int max |
| strtoumax | string to unsigned max |
字符串操作
| abbrev | stands for |
| --------- | -------------------------- |
| strcpy | string copy |
| strcpy_s | string copy safe |
| strncpy | string n copy |
| strncpy_s | string n copy safe |
| strcat | string concatenation |
| strcat_s | string concatenation safe |
| strncat | string n concatenation |
| strncat_s | string n concatetaion safe |
| strxfrm | string ?? |
字符串检查
| abbrev | stands for |
| -------- | -------------------------------- |
| strlen | string length |
| strlen_s | string length safe |
| strcmp | string compare |
| strncmp | string n compare |
| strcoll | string compare locale collation |
| strchr | string (find) character |
| strrchr | string reverse (find) character |
| strspn | string span |
| strcspn | string complementary span |
| strpbrk | string pointer break |
| strstr | string (find) string |
| strtok | string tokenizer |
| strtok_s | string tokenizer (with) state |
字符数组操作
| abbrev | stands for |
| --------- | ------------------------- |
| memchr | memory (search) character |
| memcmp | memory compare |
| memset | memory set |
| memset_s | memory set safe |
| memcpy | memory copy |
| memcpy_s | memory copy safe |
| memmove | memory move |
| memmove_s | memory move safe |
其他
| abbrev | stands for |
| ------------- | ------------------------ |
| strerror | string error |
| strerror_s | string error safe |
| strerrorlen_s | string error length safe |
以空字符结尾的多字节字符串
Multibyte/wide 字符转换
| abbrev | stands for |
| ----------- | ---------------------------------------------------------- |
| mblen | multibyte length |
| mbtowc | multibyte to wide character |
| wctomb | wide character to multibyte |
| wctomb_s | wide character to multibyte safe |
| mbstowcs | multibyte string to wide character string |
| mbstowcs_s | multibyte string to wide character string safe |
| wcstombs | wide character string to multibyte string |
| wcstombs_s | wide character string to multibyte string safe |
| msinit | initial mbstate_t |
| btowc | byte to wide character |
| wctob | wide character to byte |
| mbrlen | multibyte restartable length |
| mbrtowc | multibyte restartable to wide character |
| wcrtomb | wide character restartable to multibyte |
| wcrtomb_s | wide character restartable to multibyte safe |
| mbsrtowcs | multibyte string restartable to wide character string |
| mbsrtowcs_s | multibyte string restartable to wide character string safe |
| wcsrtombs | wide character string restartable to multibyte string |
| wcsrtombs_s | wide character string restartable to multibyte string safe |
| mbrtoc16 | multibyte restartable to character 16 |
| c16rtomb | character 16 restartable to multibyte |
| mbrtoc32 | multibyte restartable to character 32 |
| c32rtomb | character 32 restartable to multibyte |
类型
| abbrev | stands for |
| --------- | -------------------- |
| mbstate_t | multibyte state type |
| char16_t | character 16 type |
| char32_t | character 32 type |
以空字符结尾的宽字符串
人物分类
| abbrev | stands for |
| --------- | -------------------- |
| iswalnum | is wide alphanumeric |
| iswalpha | is wide alphabetic |
| iswlower | is wide lowercase |
| iswupper | is wide uppercase |
| iswdigit | is wide digit |
| iswxdigit | is wide hexadecimal |
| iswcntrl | is wide control |
| iswgraph | is wide graphical |
| iswspace | is wide space |
| iswblang | is wide blank |
| iswprint | is wide printing |
| iswpunct | is wide punctuation |
| iswctype | is wide ctype |
| wctype | wide ctype |
字符操纵
| abbrev | stands for |
| --------- | -------------------------------- |
| towlower | to wide lowercase |
| towupper | to wide uppercase |
| towctrans | to wide character transformation |
| wctrans | wide character transformation |
转换为数字格式
| abbrev | stands for |
| --------- | ------------------------------------------- |
| wcstol | wide character string to long |
| wcstoll | wide character string to long long |
| wcstoul | wide character string to unsigned long |
| wcstoull | wide character string to unsigned long long |
| wcstof | wide character string to float |
| wcstod | wide character string to double |
| wcstold | wide character string to long double |
| wcstoimax | string to int max |
| wcstoumax | string to unsigned max |
字符串操作
| abbrev | stands for |
| --------- | ----------------------------------------- |
| wcscpy | wide character string copy |
| wcscpy_s | wide character string copy safe |
| wcsncpy | wide character string n copy |
| wcsncpy_s | wide character string n copy safe |
| wcscat | wide character string concatenation |
| wcscat_s | wide character string concatenation safe |
| wcsncat | wide character string n concatenation |
| wcsncat_s | wide character string n concatenaion safe |
| wcsxfrm | wide character string ?? |
字符串检查
| abbrev | stands for |
| -------- | ----------------------------------------------- |
| wcslen | wide character string length |
| wcslen_s | wide character string length safe |
| wcscmp | wide character string compare |
| wcsncmp | wide character string n compare |
| wcscoll | wide character string compare locale collation |
| wcschr | wide character string (find) character |
| wcsrchr | wide character string reverse (find) character |
| wcsspn | wide character string span |
| wcscspn | wide character string complementary span |
| wcspbrk | wide character string pointer break |
| wcsstr | wide character string (find) string |
| wcstok | wide character string tokenizer |
| wcstok_s | wide character string tokenizer (with) state |
宽字符数组操作
| abbrev | stands for |
| ---------- | ---------------------------- |
| wmemcpy | wide memory copy |
| wmemcpy_s | wide memory copy safe |
| wmemmove | wide memory move |
| wmemmove_s | wide memory move safe |
| wmemcmp | wide memory cmp |
| wmemchr | wide memory (find) character |
| wmemset | wide momory set |
类型
| abbrev | stands for |
| --------- | ---------------------------------- |
| wchar_t | wide character type |
| wint_t | wide integer type |
| wctrans_t | wide character transformation type |
| wctype_t | wide character type type |
算法
| abbrev | stands for |
| --------- | ------------------ |
| qsort | quick sort |
| qsort_s | quick sort safe |
| bsearch | binary search |
| bsearch_s | binary search safe |
数值
数学函数
待办事项
浮点环境
待办事项
伪随机数生成
待办事项
复数算术
待办事项
泛型数学
待办事项
Input/output支持
待办事项
本地化支持
待办事项
原子操作库
待办事项
线程支持库
待办事项
POSIX
待办事项
有时我很难理解 C 函数名称的含义。例如:函数 sigprocmask
改变了阻塞信号的集合,但我不知道缩写 procmask
是什么意思。 linux man page 描述了函数的行为,但没有提到缩写。
另一个例子是常量SIGWINCH
。我知道这是一个 window 大小发生变化的信号,但是明确说明“SIGWINCH
= Signal Window Changed。” 有人知道这样的资源吗?我看过几个,他们都描述了行为,但忽略了缩写。谢谢!
我记得在我学习C的早期,知道函数缩写代表什么对我帮助很大。所以这是揭开缩写神秘面纱的尝试。
这个post关注的是缩写,而不是意思。因此需要提出一些要点:
一些缩写本身没有意义。要么是因为有些单词是隐含的,要么是因为展开缩写时字母顺序很奇怪。例如
iswprint
是 "is wide printing" 的缩写。意思是"wide character is printing character"一些缩写具有误导性。例如。
SIGFPE
中的FPE
代表 "Floating Point Exception",但该类别用于算术异常。例如。qsort
代表 "quick sort" 但标准不需要此算法,它通常实现为多态排序。
标准库
结构如下https://en.cppreference.com/w/c
类型支持
| abbrev | stands for |
| ----------- | ----------------------- |
| site_t | size type |
| ptrdiff_t | pointer difference type |
| NULL | null |
| max_align_t | max align type |
| offsetof | offset of |
| alignas | align as |
| alignof | align of |
| noreturn | no return |
程序支持实用程序
程序终止
| abbrev | stands for |
| ------------- | ------------- |
| abort | abort |
| exit | exit |
| quick_exit | quick_exit |
| _Exit | exit |
| atexit | at exit |
| at_quick_exit | at quick exit |
与环境交流
| abbrev | stands for |
| -------- | -------------------------------- |
| system | system |
| getenv | get environment (variables) |
| getenv_s | get environment (variables) safe |
信号
| abbrev | stands for |
| ------------ | ------------------ |
| signal | signal |
| raise | raise |
| sig_atomic_t | signal atomic type |
| SIG_DFL | signal default |
| SIG_IGN | signal ignore |
| SIG_ERR | signal error |
信号类型
| abbrev | stands for |
| ------- | ------------------------------- |
| SIGTERM | signal termination |
| SIGSEGV | signal segmentation violation |
| SIGINT | signal interrupt |
| SIGILL | signal illegal instruction |
| SIGABRT | signal abnormal termination |
| SIGFPE | signal floating point exception |
非本地跳转
| abbrev | stands for |
| ------- | ---------- |
| setjmp | set jump |
| longjmp | long jump |
类型
| abbrev | stands for |
| ------- | ----------- |
| jmp_buf | jump buffer |
可变函数
| abbrev | stands for |
| -------- | ------------------------ |
| va_start | variable arguments start |
| va_end | variable arguments end |
| va_copy | variable arguments copy |
| va_end | variable arguments end |
| va_list | variable arguments list |
内存管理
| abbrev | stands for |
| ------------- | ------------------------------- |
| malloc | memory allocate |
| calloc | (unknown origin for c) allocate |
| realloc | reallocate |
| free | free |
| aligned_alloc | aligned allocate |
日期和时间实用程序
待办事项
字符串库
空终止字节字符串
人物分类
| abbrev | stands for |
| -------- | --------------- |
| isalnum | is alphanumeric |
| isalpha | is alphabetic |
| islower | is lowercase |
| isupper | is uppercase |
| isdigit | is digit |
| isxdigit | is hexadecimal |
| iscntrl | is control |
| isgraph | is graphical |
| isspace | is space |
| isblang | is blank |
| isprint | is printing |
| ispunct | is punctuation |
字符操纵
| abbrev | stands for |
| ------- | ------------ |
| tolower | to lowercase |
| toupper | to uppercase |
转换为数字格式
| abbrev | stands for |
| --------- | ---------------------------- |
| atof | ascii to floating-point |
| atol | ascii to long |
| atoll | ascii to long long |
| strtol | string to long |
| strtoll | string to long long |
| strtoul | string to unsigned long |
| strtoull | string to unsigned long long |
| strtof | string to float |
| strtod | string to double |
| strotold | string to long double |
| strtoimax | string to int max |
| strtoumax | string to unsigned max |
字符串操作
| abbrev | stands for |
| --------- | -------------------------- |
| strcpy | string copy |
| strcpy_s | string copy safe |
| strncpy | string n copy |
| strncpy_s | string n copy safe |
| strcat | string concatenation |
| strcat_s | string concatenation safe |
| strncat | string n concatenation |
| strncat_s | string n concatetaion safe |
| strxfrm | string ?? |
字符串检查
| abbrev | stands for |
| -------- | -------------------------------- |
| strlen | string length |
| strlen_s | string length safe |
| strcmp | string compare |
| strncmp | string n compare |
| strcoll | string compare locale collation |
| strchr | string (find) character |
| strrchr | string reverse (find) character |
| strspn | string span |
| strcspn | string complementary span |
| strpbrk | string pointer break |
| strstr | string (find) string |
| strtok | string tokenizer |
| strtok_s | string tokenizer (with) state |
字符数组操作
| abbrev | stands for |
| --------- | ------------------------- |
| memchr | memory (search) character |
| memcmp | memory compare |
| memset | memory set |
| memset_s | memory set safe |
| memcpy | memory copy |
| memcpy_s | memory copy safe |
| memmove | memory move |
| memmove_s | memory move safe |
其他
| abbrev | stands for |
| ------------- | ------------------------ |
| strerror | string error |
| strerror_s | string error safe |
| strerrorlen_s | string error length safe |
以空字符结尾的多字节字符串
Multibyte/wide 字符转换
| abbrev | stands for |
| ----------- | ---------------------------------------------------------- |
| mblen | multibyte length |
| mbtowc | multibyte to wide character |
| wctomb | wide character to multibyte |
| wctomb_s | wide character to multibyte safe |
| mbstowcs | multibyte string to wide character string |
| mbstowcs_s | multibyte string to wide character string safe |
| wcstombs | wide character string to multibyte string |
| wcstombs_s | wide character string to multibyte string safe |
| msinit | initial mbstate_t |
| btowc | byte to wide character |
| wctob | wide character to byte |
| mbrlen | multibyte restartable length |
| mbrtowc | multibyte restartable to wide character |
| wcrtomb | wide character restartable to multibyte |
| wcrtomb_s | wide character restartable to multibyte safe |
| mbsrtowcs | multibyte string restartable to wide character string |
| mbsrtowcs_s | multibyte string restartable to wide character string safe |
| wcsrtombs | wide character string restartable to multibyte string |
| wcsrtombs_s | wide character string restartable to multibyte string safe |
| mbrtoc16 | multibyte restartable to character 16 |
| c16rtomb | character 16 restartable to multibyte |
| mbrtoc32 | multibyte restartable to character 32 |
| c32rtomb | character 32 restartable to multibyte |
类型
| abbrev | stands for |
| --------- | -------------------- |
| mbstate_t | multibyte state type |
| char16_t | character 16 type |
| char32_t | character 32 type |
以空字符结尾的宽字符串
人物分类
| abbrev | stands for |
| --------- | -------------------- |
| iswalnum | is wide alphanumeric |
| iswalpha | is wide alphabetic |
| iswlower | is wide lowercase |
| iswupper | is wide uppercase |
| iswdigit | is wide digit |
| iswxdigit | is wide hexadecimal |
| iswcntrl | is wide control |
| iswgraph | is wide graphical |
| iswspace | is wide space |
| iswblang | is wide blank |
| iswprint | is wide printing |
| iswpunct | is wide punctuation |
| iswctype | is wide ctype |
| wctype | wide ctype |
字符操纵
| abbrev | stands for |
| --------- | -------------------------------- |
| towlower | to wide lowercase |
| towupper | to wide uppercase |
| towctrans | to wide character transformation |
| wctrans | wide character transformation |
转换为数字格式
| abbrev | stands for |
| --------- | ------------------------------------------- |
| wcstol | wide character string to long |
| wcstoll | wide character string to long long |
| wcstoul | wide character string to unsigned long |
| wcstoull | wide character string to unsigned long long |
| wcstof | wide character string to float |
| wcstod | wide character string to double |
| wcstold | wide character string to long double |
| wcstoimax | string to int max |
| wcstoumax | string to unsigned max |
字符串操作
| abbrev | stands for |
| --------- | ----------------------------------------- |
| wcscpy | wide character string copy |
| wcscpy_s | wide character string copy safe |
| wcsncpy | wide character string n copy |
| wcsncpy_s | wide character string n copy safe |
| wcscat | wide character string concatenation |
| wcscat_s | wide character string concatenation safe |
| wcsncat | wide character string n concatenation |
| wcsncat_s | wide character string n concatenaion safe |
| wcsxfrm | wide character string ?? |
字符串检查
| abbrev | stands for |
| -------- | ----------------------------------------------- |
| wcslen | wide character string length |
| wcslen_s | wide character string length safe |
| wcscmp | wide character string compare |
| wcsncmp | wide character string n compare |
| wcscoll | wide character string compare locale collation |
| wcschr | wide character string (find) character |
| wcsrchr | wide character string reverse (find) character |
| wcsspn | wide character string span |
| wcscspn | wide character string complementary span |
| wcspbrk | wide character string pointer break |
| wcsstr | wide character string (find) string |
| wcstok | wide character string tokenizer |
| wcstok_s | wide character string tokenizer (with) state |
宽字符数组操作
| abbrev | stands for |
| ---------- | ---------------------------- |
| wmemcpy | wide memory copy |
| wmemcpy_s | wide memory copy safe |
| wmemmove | wide memory move |
| wmemmove_s | wide memory move safe |
| wmemcmp | wide memory cmp |
| wmemchr | wide memory (find) character |
| wmemset | wide momory set |
类型
| abbrev | stands for |
| --------- | ---------------------------------- |
| wchar_t | wide character type |
| wint_t | wide integer type |
| wctrans_t | wide character transformation type |
| wctype_t | wide character type type |
算法
| abbrev | stands for |
| --------- | ------------------ |
| qsort | quick sort |
| qsort_s | quick sort safe |
| bsearch | binary search |
| bsearch_s | binary search safe |
数值
数学函数
待办事项
浮点环境
待办事项
伪随机数生成
待办事项
复数算术
待办事项
泛型数学
待办事项
Input/output支持
待办事项
本地化支持
待办事项
原子操作库
待办事项
线程支持库
待办事项
POSIX
待办事项