My impression is that some projects are already experimenting with or using C++ in their C code bases, so C to C++ is quite likely.
My impression is that some projects are already experimenting with or using C++ in their C code bases, so C to C++ is quite likely.
However, using C and C++ together in a project is especially easy. If I were to do this, I would first get the code base compiling with a C++ compiler (this already brings some extra type safety) and is not particularly difficult.
Then I'd start replacing C code blocks with safer C++ code. This could mean changing a function, some parameter-passing conventions, replacing char* with std::string, etc.
This has the biggest chance of success I feel, and there's already success stories and strategies available that describe this method. E.g: GCC.
I'm not suggesting that C -> Rust is easier than or quite as easy as C -> C++, just that it is much easier than C -> most other languages, and that it is close enough to C -> C++ that it is worth investigating. It is definitely more robust than the minimal definition of "incremental."
When it comes to memory safe languages, your choices do not boil down to "Rust or nothing".
Of course, Mercurial gives lie to this assumption.
It takes a lot more than a toolchain to write fast code.
What it matters is if it is fast enough for the use case being targeted.
As side note I remember when C compilers for home computers generated worser code than junior Assembly programmers.
Even then, Mercurial is implemented in Python and quite usable
The fact that a Java rewrite of git actually exists demonstrates the falsity of this statement.
Otherwise yes, it could even be rewritten in Ruby, as falcolas suggested...
Many other languages support C linkage in a way that's comparable to C++.
The point is that code like in that function is a nightmare to write correctly and test in plain C.
The real way out is to eventually change to a language where safety is opt-out and not opt-in, like in C++.
I have always been on the C++, in the C vs C++ wars, but I am also aware of all those developers that just code C with a C++ compiler, hence opt-in.
If it makes you happy I can use the ANSI C++ section number instead.
So any place that is against templates and exceptions, usually rules out the standard library on those arguments.
Then you have the software houses, whose C++ code is actually C with a C++ compiler that use the bloat and slow arguments against the library.
I don't remember them by heart, but there were a couple CppCon 2014 talks where this type of arguments was discussed.
I do like to use C++ a lot on personal projects, but there I can make full use of C++ best practices.
At work, I tend to avoid using it, because most C++ developers I have met on my career, actually use it as Better C, keeping all safety loopholes from C.
I had my share of spending weeks tracking down memory corruption issues.