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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

C++ Insights – See your source code with the eyes of a compiler

219 点作者 turrini大约 1 年前

6 条评论

corysama大约 1 年前
C++ Insights is available online at <a href="https:&#x2F;&#x2F;cppinsights.io&#x2F;" rel="nofollow">https:&#x2F;&#x2F;cppinsights.io&#x2F;</a><p>It is also available at a touch of a button within the most excellent <a href="https:&#x2F;&#x2F;godbolt.org&#x2F;" rel="nofollow">https:&#x2F;&#x2F;godbolt.org&#x2F;</a><p>along side the button that takes your code sample to <a href="https:&#x2F;&#x2F;quick-bench.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;quick-bench.com&#x2F;</a><p>Those sites and <a href="https:&#x2F;&#x2F;cppreference.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;cppreference.com&#x2F;</a> are what I&#x27;m using constantly while coding.<p>I recently discovered <a href="https:&#x2F;&#x2F;whitebox.systems&#x2F;" rel="nofollow">https:&#x2F;&#x2F;whitebox.systems&#x2F;</a> It&#x27;s a local app with a $69 one-time charge. And, it only really works with &quot;C With Classes&quot; style functions. But, it looks promising as another productivity boost.
评论 #39955860 未加载
评论 #39956796 未加载
yukIttEft大约 1 年前
I <i>wish</i> there was a way to show the code that is generated when using co_return or co_await<p>e.g. <a href="https:&#x2F;&#x2F;cppinsights.io&#x2F;lnk?code=Ly8gaHR0cHM6Ly93d3cuc2NzLnN0YW5mb3JkLmVkdS9+ZG0vYmxvZy9jKystY29yb3V0aW5lcy5odG1sCgojaW5jbHVkZSA8Y29uY2VwdHM+CiNpbmNsdWRlIDxjb3JvdXRpbmU+CiNpbmNsdWRlIDxleGNlcHRpb24+CiNpbmNsdWRlIDxpb3N0cmVhbT4KCnN0cnVjdCBSZXR1cm5PYmplY3QgewogIHN0cnVj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Cg==&amp;insightsOptions=cpp20&amp;std=cpp20&amp;rev=1.0" rel="nofollow">https:&#x2F;&#x2F;cppinsights.io&#x2F;lnk?code=Ly8gaHR0cHM6Ly93d3cuc2NzLnN0...</a>
评论 #39950798 未加载
johnea大约 1 年前
I wonder how helpful it is for g++?<p>Myself and my ancient h&#x2F;w and s&#x2F;w engineering friends have been having a discussion recently about how the modern C++ language features are generating code that is not readily debugged at the source level.<p>The compiler has always created assembly that implements the feature described by teh high level language, but histoirically these have had a relatively one-to-one relationship with the source code.<p>However in the world of post C++11 many more abstracted features are supported, and they no longer have any kind of relation to the source in terms of something you could inspect with a debugger (except in assembly).<p>So it seems a tool like this is really useful, but unfortunately almost inherently compiler specific.<p>Maybe GNU can port this to g++?
评论 #39950345 未加载
评论 #39948903 未加载
评论 #39949026 未加载
评论 #39950788 未加载
评论 #39970119 未加载
评论 #39949746 未加载
nurettin大约 1 年前
It looks like a perfect candidate for a vs code extension.
评论 #39950813 未加载
评论 #39950630 未加载
scrubs大约 1 年前
Great git Readme! Practical and helpful. I&#x27;m def interested. Thanks!
ColonelPhantom大约 1 年前
Honestly, from the title, I expected something that gave actual &#x27;insights&#x27; into the compiler, rather than the code. For example, indicating applied and potential (missed) optimizations. But seeing what it was, I was definitely not unpleasantly surprised :)<p>Being able to cut through abstraction is very nice and quite important when you want to understand WHAT you are writing from the machine&#x27;s perspective (or even in general when you don&#x27;t know the abstraction yet). I love using Haskell, but have no idea what kind of machine code GHC spits out at the end (something based on the spineless tagless G-machine, an abstraction I barely understand by itself).
评论 #39951122 未加载
评论 #39949191 未加载
评论 #39950090 未加载
评论 #39951890 未加载