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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Clang will more aggressively use undefined behavior on pointer addition overflow

5 点作者 mafuy大约 1 个月前

2 条评论

hagreet大约 1 个月前
Can somebody explain what the optimizations are that this enables?<p>Of course you can optimize away the checks but that doesn&#x27;t count in my world because people put in these checks to make sure there is no overflow and optimizing them away is just wrong.<p>But I am sure there are other interesting optimizations that this allows and since I am generally against UB I am curious what those are.
mafuy大约 1 个月前
&gt; Clang will now more aggressively use undefined behavior on pointer addition overflow for optimization purposes. For example, a check like ptr + unsigned_offset &lt; ptr will now optimize to false, because ptr + unsigned_offset will cause undefined behavior if it overflows (or advances past the end of the object).
评论 #43703485 未加载