.. title:: clang-tidy - cert-err33-c

cert-err33-c
============

Warns on unused function return values. Many of the standard library functions
return a value that indicates if the call was successful. Ignoring the returned
value can cause unexpected behavior if an error has occurred. The following
functions are checked:

* aligned_alloc()
* asctime_s()
* at_quick_exit()
* atexit()
* bsearch()
* bsearch_s()
* btowc()
* c16rtomb()
* c32rtomb()
* calloc()
* clock()
* cnd_broadcast()
* cnd_init()
* cnd_signal()
* cnd_timedwait()
* cnd_wait()
* ctime_s()
* fclose()
* fflush()
* fgetc()
* fgetpos()
* fgets()
* fgetwc()
* fopen()
* fopen_s()
* fprintf()
* fprintf_s()
* fputc()
* fputs()
* fputwc()
* fputws()
* fread()
* freopen()
* freopen_s()
* fscanf()
* fscanf_s()
* fseek()
* fsetpos()
* ftell()
* fwprintf()
* fwprintf_s()
* fwrite()
* fwscanf()
* fwscanf_s()
* getc()
* getchar()
* getenv()
* getenv_s()
* gets_s()
* getwc()
* getwchar()
* gmtime()
* gmtime_s()
* localtime()
* localtime_s()
* malloc()
* mbrtoc16()
* mbrtoc32()
* mbsrtowcs()
* mbsrtowcs_s()
* mbstowcs()
* mbstowcs_s()
* memchr()
* mktime()
* mtx_init()
* mtx_lock()
* mtx_timedlock()
* mtx_trylock()
* mtx_unlock()
* printf_s()
* putc()
* putwc()
* raise()
* realloc()
* remove()
* rename()
* setlocale()
* setvbuf()
* scanf()
* scanf_s()
* signal()
* snprintf()
* snprintf_s()
* sprintf()
* sprintf_s()
* sscanf()
* sscanf_s()
* strchr()
* strerror_s()
* strftime()
* strpbrk()
* strrchr()
* strstr()
* strtod()
* strtof()
* strtoimax()
* strtok()
* strtok_s()
* strtol()
* strtold()
* strtoll()
* strtoumax()
* strtoul()
* strtoull()
* strxfrm()
* swprintf()
* swprintf_s()
* swscanf()
* swscanf_s()
* thrd_create()
* thrd_detach()
* thrd_join()
* thrd_sleep()
* time()
* timespec_get()
* tmpfile()
* tmpfile_s()
* tmpnam()
* tmpnam_s()
* tss_create()
* tss_get()
* tss_set()
* ungetc()
* ungetwc()
* vfprintf()
* vfprintf_s()
* vfscanf()
* vfscanf_s()
* vfwprintf()
* vfwprintf_s()
* vfwscanf()
* vfwscanf_s()
* vprintf_s()
* vscanf()
* vscanf_s()
* vsnprintf()
* vsnprintf_s()
* vsprintf()
* vsprintf_s()
* vsscanf()
* vsscanf_s()
* vswprintf()
* vswprintf_s()
* vswscanf()
* vswscanf_s()
* vwprintf_s()
* vwscanf()
* vwscanf_s()
* wcrtomb()
* wcschr()
* wcsftime()
* wcspbrk()
* wcsrchr()
* wcsrtombs()
* wcsrtombs_s()
* wcsstr()
* wcstod()
* wcstof()
* wcstoimax()
* wcstok()
* wcstok_s()
* wcstol()
* wcstold()
* wcstoll()
* wcstombs()
* wcstombs_s()
* wcstoumax()
* wcstoul()
* wcstoull()
* wcsxfrm()
* wctob()
* wctrans()
* wctype()
* wmemchr()
* wprintf_s()
* wscanf()
* wscanf_s()

This check is an alias of check :doc:`bugprone-unused-return-value <../bugprone/unused-return-value>`
with a fixed set of functions.

Suppressing issues by casting to ``void`` is enabled by default and can be
disabled by setting `AllowCastToVoid` option to ``false``.

The check corresponds to a part of CERT C Coding Standard rule `ERR33-C.
Detect and handle standard library errors
<https://wiki.sei.cmu.edu/confluence/display/c/ERR33-C.+Detect+and+handle+standard+library+errors>`_.
The list of checked functions is taken from the rule, with following exception:

* The check can not differentiate if a function is called with ``NULL``
  argument. Therefore the following functions are not checked:
  ``mblen``, ``mbrlen``, ``mbrtowc``, ``mbtowc``, ``wctomb``, ``wctomb_s``
