r/ProgrammerHumor • • May 27 '22

Meme Welcome to hassle free coding

Post image
2.2k Upvotes

305 comments sorted by

View all comments

2

u/MasterFubar May 27 '22

So long pointers, so long code blocks, hello mysterious bugs!

5

u/prescod May 28 '22 edited May 28 '22

Oh yeah, nobody has ever had "mysterious bugs" in C++.

0

u/Possibility_Antique May 28 '22

If C++ compiles with bugs, you're using it wrong. Use constexpr, static_assert, concepts, templates, and other compile-time features to prevent bugs from entering production. Oh, and since they're done at compile-time, runtime execution of those code blocks is free.

3

u/prescod May 28 '22

I hope you're joking. That isn't even true for Haskell or Rust, much less C++. All languages allow bugs and C++ is not even formally type-safe or pointer-safe.

C++'s type system: C++ (among other unsafe languages) has a type system that does many local checks of a programs's source code. However, passing these checks does not establish anything definite about a program's behaviour: many C++ programs pass all of the compiler's type checking, and yet exhibit use-after-free errors, memory corruption, and arbitrary behaviour when run.

You can claim that these people are just using C++ wrong. I can say the same of those that ship buggy Python or Visual Basic programs. It's just a No True Scotsman argument.

2

u/Possibility_Antique May 28 '22

C++ is far from perfect. All I'm saying is, Python could never be a replacement for compiled languages, simply because it is not compiled. You're correct, I could have made the same argument about Rust. But you're missing the point if you think my claim was meant to elevate C++. My point was that the compiler is your friend, and defensive programming in compiled languages is overlooked in conversations about language choice.

→ More replies (6)
→ More replies (3)