Settings

Theme

C versus C++: Fight

starfighter.acornarcade.com

3 points by cyber1 a year ago · 2 comments

Reader

thesuperbigfrog a year ago

Having used both C and C++ they both have strengths and weaknesses and each is better suited for certain kinds of problems:

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.

The power of C in a single page of code: https://www.jsoftware.com/ioj/iojATW.htm

C++: powerful, complex, efficient, builds upons C's strengths and C's weaknesses; can be difficult to debug, has grown immensely complex and difficult to "keep it all in your head".

"Why should I have written ZeroMQ in C, not C++": https://250bpm.com/blog:4/

But C and C++, while ubiquitous are not safe:

"A Guide to Undefined Behavior in C and C++": https://blog.regehr.org/archives/213

I resisted Rust at first and then I decided to try out Rust for Advent of Code. It was impressive. I read "Programming Rust, 2nd Edition" by Jim Blandy, Jason Orendorff, and Leonora F. S. Tindall (https://learning.oreilly.com/library/view/programming-rust-2...) 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.

Today, I view C and C++ as legacy languages that will be replaced with safer alternatives like Rust.

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection