TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Clang is better than GCC

5 点作者 mrich超过 2 年前

1 comment

suprjami超过 2 年前
No one linter or static analysis tool will pick up every possible error.<p>cppcheck picks this up (a bit cryptically):<p><pre><code> 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)) </code></pre> PVS-Studio picks it up too (more precisely):<p><pre><code> &lt;source&gt;:17:1: error: V526 The &#x27;memcmp&#x27; function returns 0 if corresponding buffers are equal. Consider examining the condition for mistakes. </code></pre> flawfinder doesn&#x27;t catch anything either. That doesn&#x27;t mean &quot;cppcheck is better than flawfinder&quot;.<p>The error here is in the programmer relying on one tool as source of truth.