Search code examples
coperating-systemsystem-callsmanpage

Is there documentation that describes what C function names "stand for" (not what they do--rather, what the abreviated name means)?


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!


Solution

  • 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 printable". The meaning is "wide character is a 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

    Symbol Meaning
    size_t size type
    ptrdiff_t pointer difference type
    NULL null
    max_align_t maximum align type
    offsetof offset of
    alignas align as
    alignof align of
    noreturn no return

    Program support utilities

    Program termination

    Symbol Meaning
    abort abort
    exit exit
    quick_exit quick exit
    _Exit exit
    atexit at exit
    at_quick_exit at quick exit

    Communicating with the environment

    Symbol Meaning
    system system
    getenv get environment (variables)
    getenv_s get environment (variables) safe

    Signals

    Symbol Meaning
    signal signal
    raise raise
    sig_atomic_t signal atomic type
    SIG_DFL signal default
    SIG_IGN signal ignore
    SIG_ERR signal error

    Signal Types

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

    Symbol Meaning
    setjmp set jump
    longjmp long jump

    Types

    Symbol Meaning
    jmp_buf jump buffer

    Variadic function

    Symbol Meaning
    va_start variable arguments start
    va_end variable arguments end
    va_copy variable arguments copy
    va_arg variable arguments' argument
    va_list variable arguments list

    Memory management

    Symbol Meaning
    malloc memory allocation
    calloc clean allocation
    aligned_alloc aligned allocation
    realloc reallocate
    free free

    Date and time utilities

    TODO

    String Library

    Null-terminated byte strings

    Character classification

    Symbol Meaning
    isalnum is alphanumeric
    isalpha is alphabetic
    islower is lowercase
    isupper is uppercase
    isdigit is digit
    isxdigit is hexadecimal digit
    iscntrl is control
    isgraph is graphic
    isspace is space
    isblank is blank
    isprint is printable
    ispunct is punctuation

    Character manipulation

    Symbol Meaning
    tolower to lowercase
    toupper to uppercase

    Conversions to numeric formats

    Symbol Meaning
    atof ASCII to floating-point
    atoi ASCII to int
    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
    strtold string to long double
    strtoimax string to intmax_t
    strtoumax string to uintmax_t

    String manipulation

    Symbol Meaning
    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 concatenation safe
    strxfrm string transformation

    String examination

    Symbol Meaning
    strlen string length
    strlen_s string length safe
    strcmp string comparison
    strncmp string n comparison
    strcoll string 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 tokenization
    strtok_s string tokenization safe

    Character array manipulation

    Symbol Meaning
    memchr memory (search) character
    memcmp memory comparison
    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

    Symbol Meaning
    strerror string error
    strerror_s string error safe
    strerrorlen_s string error length safe

    Null-terminated multibyte strings

    Multibyte/wide character conversions

    Symbol Meaning
    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
    mbsinit mbstate_t initialization
    btowc byte to wide character
    wctob wide character to byte
    mbrlen multibyte reentrant length
    mbrtowc multibyte reentrant to wide character
    wcrtomb wide character reentrant to multibyte
    wcrtomb_s wide character reentrant to multibyte safe
    mbsrtowcs multibyte string reentrant to wide character string
    mbsrtowcs_s multibyte string reentrant to wide character string safe
    wcsrtombs wide character string reentrant to multibyte string
    wcsrtombs_s wide character string reentrant to multibyte string safe
    mbrtoc16 multibyte reentrant to char16_t
    c16rtomb char16_t reentrant to multibyte
    mbrtoc32 multibyte reentrant to char32_t
    c32rtomb char32_t reentrant to multibyte

    Types

    Symbol Meaning
    mbstate_t multibyte state type
    char16_t character 16-bit type
    char32_t character 32-bit type

    Null-terminated wide strings

    Character classification

    Symbol Meaning
    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 graphic
    iswspace is wide space
    iswblank is wide blank
    iswprint is wide printable
    iswpunct is wide punctuation
    iswctype is wide character type
    wctype wide character type

    Character manipulation

    Symbol Meaning
    towlower to wide lowercase
    towupper to wide uppercase
    towctrans to wide character transformation
    wctrans wide character transformation

    Conversions to numeric formats

    Symbol Meaning
    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 wide character string to intmax_t
    wcstoumax wide character string to uintmax_t

    String manipulation

    Symbol Meaning
    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 concatenation safe
    wcsxfrm wide character string transformation

    String examination

    Symbol Meaning
    wcslen wide character string length
    wcslen_s wide character string length safe
    wcscmp wide character string comparison
    wcsncmp wide character string n comparison
    wcscoll wide character string 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 tokenization
    wcstok_s wide character string tokenization safe

    Wide character array manipulation

    Symbol Meaning
    wmemchr wide memory (search) character
    wmemcmp wide memory comparison
    wmemset wide memory set
    wmemcpy wide memory copy
    wmemcpy_s wide memory copy safe
    wmemmove wide memory move
    wmemmove_s wide memory move safe

    Types

    Symbol Meaning
    wchar_t wide character type
    wint_t wide integer type
    wctrans_t wide character transformation type
    wctype_t wide character type type

    Algorithms

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