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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

“That is either genius, or a seriously diseased mind.” – Linus Torvalds

76 点作者 sooham超过 5 年前

3 条评论

roelschroeven超过 5 年前
In that post Linus says something I don&#x27;t understand in that post:<p>&quot;... So with a constant, we have<p><pre><code> sizeof( 1 ? NULL : (int *) 1) </code></pre> and the rule is that if one of the sides of a ternary operation with pointers is NULL, the end result is the other type (int *).&quot;<p>Is Linus saying that the condition of the ternary operation doesn&#x27;t matter if one of the sides is NULL? That it then always evaluates to the other side? That&#x27;s not what happens when I try it. Or are there special rules when sizeof is applied?
评论 #20836954 未加载
rurban超过 5 年前
I really need this for libc optimizations. So far it only worked in C++ mode or newer clang&#x27;s, but not in gcc.
msarnoff超过 5 年前
Isn&#x27;t this what GCC&#x27;s `__builtin_constant_p()` does?