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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Results of the Grand C++ Error Explosion Competition (2014)

250 点作者 st_goliath大约 1 年前

14 条评论

WalterBright大约 1 年前
The D language compiler uses a technique I call &quot;poisoning&quot; which has greatly reduced cascading error messages. The idea is whenever an error is found in an AST node, the AST node is replaced with an &quot;error&quot; node. Any combination of an error node with another node is replaced with an error node. Error messages for error nodes are suppressed.<p>It works far better than attempting to repair the AST into some plausible state.<p>It&#x27;s analogous to the propagation of NaN values in floating point code.
评论 #40278771 未加载
评论 #40281281 未加载
评论 #40282178 未加载
评论 #40278224 未加载
评论 #40278592 未加载
AlotOfReading大约 1 年前
I like to increment the most significant digit of my terminal history size every time I run into a compiler error that exceeds the previous value. On Saturday, it went up from 40k to 50k.<p>I laugh to hide my pain.
评论 #40278607 未加载
评论 #40278124 未加载
评论 #40279933 未加载
评论 #40278662 未加载
cgh大约 1 年前
Some of the category descriptions are great, eg for &quot;Most lifelike&quot;:<p>Suppose you are given a task of adding some new functionality to an existing code base. You have been told that the guy who wrote it was “really smart” and that his code is of “enterprise quality”. You check out the code and open a random file in an editor. It appears on the screen. After just one microsecond of looking at the code you have lost your will to live and want nothing more than to beat your head against the table until you lose consciousness.<p>This entry could be that code.
kazinator大约 1 年前
Creative Computing magazine in the 1970&#x27;s had this kind of competition: most errors out of the smallest program, in any language.<p>Back that day, it was possible because parsers tried to repair bad input to try to keep going, in hopes of diagnosing as many real errors as possible, so as to reduce the number of iterations. Iterations used to be expensive: punching corrections onto cards, etc.<p>If the parser repairs bad syntax, it can cause more errors. If a repair involves insertion, there is a risk of getting into an infinite loop of diagnostics, even.<p>It&#x27;s kind of anachronistic to have people playing this with C++.<p>Why is this 2014? Did that error explosion competition die out?<p>Maybe tumblr isn&#x27;t where you find C++ people.
评论 #40284525 未加载
underdeserver大约 1 年前
<i>Multiplier: 5.9 billion</i><p>That&#x27;s... several orders of magnitude larger than I&#x27;d have guessed.
评论 #40279444 未加载
评论 #40277979 未加载
jcalvinowens大约 1 年前
Generally speaking, clang produces much clearer C++ compile errors than gcc. I can&#x27;t give any specific examples off the top of my head, but I&#x27;ve seen GCC emit hundreds of lines of inscrutable errors where clang spits out one line that tells you exactly what is wrong.
评论 #40281266 未加载
评论 #40284038 未加载
gsliepen大约 1 年前
10 years afterwards and GCC still produces the huge error messages. It seems Clang is now smart enough to stop compiling after too many errors.
评论 #40279718 未加载
hughw大约 1 年前
I&#x27;ve mostly become adept at traversing six mile long compile error crawls to find the bit in my code causing the STL&#x2F;Thrust complaint. clang is more legible for this than gcc. Still, I keep learning new patterns.
not2b大约 1 年前
It might be interesting to see how much expansion could be obtained with Rust. The diagnostics can be verbose, and perhaps there&#x27;s some kind of self-reference that could produce a similar blowup, though I&#x27;m not familiar enough with the corners to say.
maxlin大约 1 年前
What&#x27;s the point in not showing the actual results? Is the expectation really to have a compiler handy just to browse the results
评论 #40279702 未加载
评论 #40279803 未加载
axra大约 1 年前
This is super interesting. I will do a 2024 edition.
quotemstr大约 1 年前
Has anyone tried these code snippets on modern compilers and noted how much our error messages have improved?
评论 #40281278 未加载
eru大约 1 年前
I tried the first entry &#x27;Biggest error, category Anything&#x27; and was disappointed when the error message was really short. But I had made the &#x27;mistake&#x27; of using clang++, with g++ I get the crazy long error as promised.
lqet大约 1 年前
The difference between an experienced C++ programmer and a C++ novice is that the novice regularly believes that his code <i>is broken beyond repair for eternity and has accidentally destroyed the compiler and most of the hard drive</i>, while the former just yawns at 5,000 lines of error messages and adds the missing semicolon.
评论 #40278792 未加载
评论 #40280277 未加载
评论 #40280510 未加载
评论 #40278643 未加载
评论 #40278606 未加载