Although I haven’t used it since college, I actually liked C++ especially once I understood pointers.

@wim@lemmy.sdf.org
link
fedilink
29
edit-2
1Y

Everything is fine within the scope of a college course or project.

Where C++ breaks down is large, complicated projects where you colaborate with other developers over multiple years.

I worked in C++ for almost a decade, and while there were a few good projects I encountered, most suffered from one or more of the following problems:

  • C++ has so many parts, everyone picks a subset they think is “good”, but noone seems to fully agree on what that subset is.
  • A side effect of the many possibilities C++ offers to compose or abstract your project is that it allows for developers to be “clever”. However, this often results in code that is hard to maintain or understand, especially for other developers.
  • Good C++ is very hard. Not everyone is a C++ veteran that read dozens of books or has a robust body of knowledge on all its quirks and pitfalls, and those people are also often assigned to your project and contribute to it. I was certainly never an expert, despite a lot of time and effort spent learning and using C++.
@257m@lemmy.ml
link
fedilink
8
edit-2
1Y

Just use C. It solves all those problens given the most complicated feature is pointers and those hard aren’t to understand.

While C is certainly better for some problems in my experience, it too is very hard to use in large projects with a mix of developers, and it is unsuitable for most higher level applications in most companies.

I think C has its place in the world still, which is mostly confined low level embedded, kernel space and malware. I do believe that the market segment that used to rely on C++ is today better served by either Go or Rust, depending on the project.

That said, while I LOVE working with Rust, it suffers from many of the same issues I mentioned for C++ in my comment above when working in a mixed skillset team.

I agree, unless you doing low level stuff where you need absolute control you should use a modern language with proper abstraction just to save time. Most use cases where they use C++ can be replaced with Rust or Go as they aren’t saddled with years tech debt and bloat due to having mantaining backwards compatibility.

So would there be a happy medium between C and C++? A C+, if you will.

-0.5 + (float) C++

Yes, use C++, but with extern "C" for everything so you can easily interface with other software. That limits you to no classes or namespaces, but internally you can use smart pointers, vectors, maps and actual strings.

There is actually a C+, also called “orthodox” C++ https://gist.github.com/bkaradzic/2e39896bc7d8c34e042b

Thanks! I figured someone must have tried it.

I’m going to go ahead and say that’s not really a superset of C. But, yes, that’s the way everything is going in practice.

No not literally but you got it lol

Create a post

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

  • Posts must be relevant to programming, programmers, or computer science.
  • No NSFW content.
  • Jokes must be in good taste. No hate speech, bigotry, etc.
  • 1 user online
  • 54 users / day
  • 172 users / week
  • 445 users / month
  • 2.42K users / 6 months
  • 1 subscriber
  • 1.61K Posts
  • 35.6K Comments
  • Modlog