Comment by TuxSH
6 months ago
IMHO C++ scales far better for large, self-contained, personal projects though it requires slightly more initial investment.
And if you're targeting PC, you might be better off using Python to begin with (if perf is not a concern)
What specifically makes it scale better in your opinion?
- "All" C libraries use some form of namespacing (the typical mylib_dosomething kind of name); actual namespaces mean you don't write these prefixes over and over again when in the same namespace
- "Most" C projects do basic OOP, many C projects even do inheritance via composition and a fair few of these do virtual dispatch too
- Templates (esp. since C++20), lambda functions, overloads and more recently coroutines (which are fancy FSM in their impl), etc. reduce boilerplate a lot
- Containers (whether std:: or one's own) are far easier to work with in C++, a lot less boilerplate overall (GDB leveraged this during their migration iirc)
- string_view makes non-destructive substring manipulation a lot easier; chrono literals (in application code) make working with durations a lot more readable too
In the past decade or two, major projects like GCC and GDB have migrated from C to C++.
Obviously, C retains advantages over C++, but they are fairly limited: faster build times, not having to worry about exposing "extern C" interface in libraries, not having to worry about controversial features like exceptions and (contextually) magic statics and so on...
Nicely said!
One other key thing is encapsulation provided via various C++ syntax which is missing in C (where only file scope is possible).