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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

C versus C++: Fight

3 点作者 cyber110 个月前

1 comment

thesuperbigfrog10 个月前
Having used both C and C++ they both have strengths and weaknesses and each is better suited for certain kinds of problems:<p>C: simple, ubiquitous, FFI with practically everything, practical direct access to the hardware; requires significant effort to build bigger things, feels more fragile at larger scales.<p>The power of C in a single page of code: <a href="https:&#x2F;&#x2F;www.jsoftware.com&#x2F;ioj&#x2F;iojATW.htm" rel="nofollow">https:&#x2F;&#x2F;www.jsoftware.com&#x2F;ioj&#x2F;iojATW.htm</a><p>C++: powerful, complex, efficient, builds upons C&#x27;s strengths <i>and</i> C&#x27;s weaknesses; can be difficult to debug, has grown immensely complex and difficult to &quot;keep it all in your head&quot;.<p>&quot;Why should I have written ZeroMQ in C, not C++&quot;: <a href="https:&#x2F;&#x2F;250bpm.com&#x2F;blog:4&#x2F;" rel="nofollow">https:&#x2F;&#x2F;250bpm.com&#x2F;blog:4&#x2F;</a><p>But C and C++, while ubiquitous are not safe:<p>&quot;A Guide to Undefined Behavior in C and C++&quot;: <a href="https:&#x2F;&#x2F;blog.regehr.org&#x2F;archives&#x2F;213" rel="nofollow">https:&#x2F;&#x2F;blog.regehr.org&#x2F;archives&#x2F;213</a><p>I resisted Rust at first and then I decided to try out Rust for Advent of Code. It was impressive. I read &quot;Programming Rust, 2nd Edition&quot; by Jim Blandy, Jason Orendorff, and Leonora F. S. Tindall (<a href="https:&#x2F;&#x2F;learning.oreilly.com&#x2F;library&#x2F;view&#x2F;programming-rust-2nd&#x2F;9781492052586&#x2F;cover.html" rel="nofollow">https:&#x2F;&#x2F;learning.oreilly.com&#x2F;library&#x2F;view&#x2F;programming-rust-2...</a>) and was more impressed by the design decisions and pitfalls that Rust avoids. We started using Rust at $WORK to replace a tool written in C and discovered many hidden bugs in the C implementation and gained maintainability and better performance.<p>Today, I view C and C++ as legacy languages that will be replaced with safer alternatives like Rust.