3

Sometimes I have a hard time deciphering what C function names stand for. For example: the function sigprocmask changes the set of blocked signals, but I have no clue what the abbreviation procmask means. The linux man page describes the behavior of the function, but does not mention the abbreviation.

Another example is the constant SIGWINCH. I understand it is a singal that a window sized has changed, but it would be handy to have that plainly stated "SIGWINCH = Signal Window Changed." Does anyone know of such a resource? I have looked at several, and they all described the behavior, but ignored abbrevations. Thanks!

melpomene
  • 84,125
  • 8
  • 85
  • 148
cgoates
  • 55
  • 1
  • 6
  • `sigprocmask` — signal process mask, or signal mask for process. Then the questions are "do you know what a signal is, and what a process is, and what the signal mask for a process is?" The name section of the manual page sometimes gives the meaning. The set of names was developed by numerous people working over many years — extreme consistency is not to be expected. – Jonathan Leffler Oct 04 '18 at 04:23
  • These are not C names. They are not defined by the C standard, nor are they particular to C (they may be used in other languages). They are parts of sets of software, such as Unix or Windows subsystems. Learning about software from reference pages can be a nuisance, as you have seen, especially since the man pages throw everything together. A better way to learn is to find primers, tutorials, or textbook material covering the specific subsystems or other software. This depends on the particular routines; you need a different document for each subsystem, so no single general document exists. – Eric Postpischil Oct 04 '18 at 10:26

1 Answers1

4

I remember in my early days of learning C that knowing what the function abbreviation stand for helped me a lot. So this is an attempt to demystify the abbreviations.

This post focuses on the abbreviation, not on the meaning. Thus some important points need to be raised:

  • some abbreviations do not make make sense just by themselves. Either because some words are implicit, or because the order of the letters is weird when expanding the abbreviation. For instance iswprint is an abbreviation for "is wide printing". The meaning is "wide character is printing character"

  • some abbreviation are misleading. E.g. the FPE in SIGFPE stands for "Floating Point Exception", but the category is for arithmetic exceptions. E.g. qsort stands for "quick sort" but the standard doesn't require this algorithm and it is usually implemented as a polymorphic sort.


Standard Library

Structure follows https://en.cppreference.com/w/c

Type Support

| 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               |

Program support utilities

Program termination

| abbrev        | stands for    |
| ------------- | ------------- |
| abort         | abort         |
| exit          | exit          |
| quick_exit    | quick_exit    |
| _Exit         | exit          |
| atexit        | at exit       |
| at_quick_exit | at quick exit |

Communicating with the environment

| abbrev   | stands for                       |
| -------- | -------------------------------- |
| system   | system                           |
| getenv   | get environment (variables)      |
| getenv_s | get environment (variables) safe |

Signals

| 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       |

Signal Types

| 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 |

Non-local jumps

| abbrev  | stands for |
| ------- | ---------- |
| setjmp  | set jump   |
| longjmp | long jump  |

Types

| abbrev  | stands for  |
| ------- | ----------- |
| jmp_buf | jump buffer |

Variadic function

| 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  |

Memory management

| abbrev        | stands for                      |
| ------------- | ------------------------------- |
| malloc        | memory allocate                 |
| calloc        | (unknown origin for c) allocate |
| realloc       | reallocate                      |
| free          | free                            |
| aligned_alloc | aligned allocate                |

Date and time utilities

TODO

String Library

Null-terminated byte strings

Character classification

| 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  |

Character manipulation

| abbrev  | stands for   |
| ------- | ------------ |
| tolower | to lowercase |
| toupper | to uppercase |

Conversions to numeric formats

| 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       |

String manipulation

| 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 ??                  |

String examination

| 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    |

Character array manipulation

| 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          |

Miscellaneous

| abbrev        | stands for               |
| ------------- | ------------------------ |
| strerror      | string error             |
| strerror_s    | string error safe        |
| strerrorlen_s | string error length safe |

Null-terminated multibyte strings

Multibyte/wide character conversions

| 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                      |

Types

| abbrev    | stands for           |
| --------- | -------------------- |
| mbstate_t | multibyte state type |
| char16_t  | character 16 type    |
| char32_t  | character 32 type    |

Null-terminated wide strings

Character classification

| 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           |

Character manipulation

| abbrev    | stands for                       |
| --------- | -------------------------------- |
| towlower  | to wide lowercase                |
| towupper  | to wide uppercase                |
| towctrans | to wide character transformation |
| wctrans   | wide character transformation    |

Conversions to numeric formats

| 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                      |

String manipulation

| 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 ??                  |

String examination

| 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    |

Wide character array manipulation

| 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              |

Types

| 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           |

Algorithms

| abbrev    | stands for         |
| --------- | ------------------ |
| qsort     | quick sort         |
| qsort_s   | quick sort safe    |
| bsearch   | binary search      |
| bsearch_s | binary search safe |

Numerics

Mathematical functions

TODO

Floating-point environment

TODO

Pseudo-random number generation

TODO

Complex number arithmetic

TODO

Type-generic math

TODO

Input/output support

TODO

Localization support

TODO

Atomic operations library

TODO

Thread support library

TODO

POSIX

TODO

bolov
  • 72,283
  • 15
  • 145
  • 224