TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

C versus C++: Fight

3 pointsby cyber110 months ago

1 comment

thesuperbigfrog10 months ago
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.