The zlib example code (demonstrated in http://zlib.net/zlib_how.html and available from http://zlib.net/zpipe.c) is reported as "Uninitialized variable: out" on line 70. The out buffer is indeed unitialized, but passed as strm.next_out to deflate function where it is used. I'd consider this as an edge case. What is best practice here? I know I can silence the error diagnostic via // cppcheck-suppress uninitvar comment.
Last edit: tbeu 2024-02-25
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
The zlib example code (demonstrated in http://zlib.net/zlib_how.html and available from http://zlib.net/zpipe.c) is reported as "Uninitialized variable: out" on line 70. The out buffer is indeed unitialized, but passed as strm.next_out to deflate function where it is used. I'd consider this as an edge case. What is best practice here? I know I can silence the error diagnostic via
// cppcheck-suppress uninitvar
comment.Last edit: tbeu 2024-02-25
Seems I can't edit the topic typo defalte->deflate.
The code looks similar to this issue: https://trac.cppcheck.net/ticket/12461
Right, pretty likely a duplicate. Thanks for the pointer.
Last edit: tbeu 2024-02-25