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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

C is not just a bad language

3 点作者 matesz超过 1 年前

2 条评论

dswilkerson超过 1 年前
&quot;v later found out with more debugging that it happened because the module in question cast that struct back from memory, and then added its own stuff to it.&quot;<p>That&#x27;s your problem right there: &quot;cast&quot;. In C, you can cast things, but doing so breaks the type system, which can no longer help you. That&#x27;s not the fault of C, that&#x27;s your fault. You literally asked for it.<p>C is the useful idioms of assembly language made first-class. For fundamental reasons of the universe, C is <i>the</i> programming language. See also: <a href="https:&#x2F;&#x2F;embeddedgurus.com&#x2F;barr-code&#x2F;2018&#x2F;02&#x2F;c-the-immortal-programming-language&#x2F;" rel="nofollow">https:&#x2F;&#x2F;embeddedgurus.com&#x2F;barr-code&#x2F;2018&#x2F;02&#x2F;c-the-immortal-p...</a><p>&quot;This year a portion of my analysis is focused on multi-year trends. One trend that really stands out to me is that the C programming language refuses to give up the ghost.<p>&quot;A longitudinal study of survey data spanning almost a decade and a half shows that C remains the primary programming language of embedded software. Remarkably, in that time C has actually gained market share from 50% to about 70%–at the expense of assembly, C++, and Java.&quot;
paulrpotts超过 1 年前
It&#x27;s a funny dunk on the language but I was hoping for some actual root cause analysis. It sounds like the change actually uncovered a pre-existing bug which was not (yet) causing a crash (but may have been silently overwriting memory). In that case, the root cause was the existing code&#x27;s failure to use memory safely. There&#x27;s not much point blaming a 50-year-old language, which was never designed with modern type safety but instead has features that allow deliberately throwing away safety to make low-level systems programming possible, for not having modern type safety. The generation of programmers who learned to use it as safely as possible (which I belong to) are getting old and cranky. We&#x27;re now inclined to say that the person who wrote the pre-existing bug needed more experience. We&#x27;d all love to use Rust for new code but there&#x27;s an awful lot of legacy C code that needs fixing.