Hacker News new | past | comments | ask | show | jobs | submit login
Clang is better than GCC (yurichev.org)
5 points by mrich 4 months ago | hide | past | favorite | 1 comment

No one linter or static analysis tool will pick up every possible error.

cppcheck picks this up (a bit cryptically):

    clang-gcc.c:17:72: error: Invalid memcmp() argument nr 3. A non-boolean value is required. [invalidFunctionArgBool]
      if (memcmp(m_result_original, m_result_my_version, sizeof(struct tmp)!=0))
PVS-Studio picks it up too (more precisely):

    <source>:17:1: error: V526 The 'memcmp' function returns 0 if corresponding buffers are equal. Consider examining the condition for mistakes.
flawfinder doesn't catch anything either. That doesn't mean "cppcheck is better than flawfinder".

The error here is in the programmer relying on one tool as source of truth.

Applications are open for YC Summer 2023

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact