As already mentioned. It exists, D Lang. It’s a better C and a better C++. It has a runtime, which you can choose or not use. It is ABI compatible with C, and C++ ABI is a work in progress.<p>You can switch from writing C to D, and still use all of the existing C libraries and code you do today. You can even use D libraries in your C projects.<p>There is the betterC flag that can be used as well which essentially turns off the D Lang runtime.<p>The runtime allows garbage collection and other memory safety that more modern languages like Java and C# have spoiled use with. Also allowing for write once, compile every where. Making it a very portable language.<p><a href="http://www.dlang.org" rel="nofollow">http://www.dlang.org</a><p>The other benefit is it is a language not owned and developed by a corporation like Java, C#, objective-C and go. So there is no ulterior motive’s or agendas by said corporation.
A better C would be C with a few features of C++: function and operator overloading and references. Also metaprogramming... maybe not exactly C++ templates but some sort of macros. Also lambdas.<p>I would also remove the distinction between 'class' and 'struct' and just have 'struct'.<p>I would add the bracket shorthand [] for arrays and {} for maps (and add a map type, maybe.)<p>And honestly, the more I think about it, the more a "better C" starts to look like a "better Lua," with the ability to return multiple values from a function.
Probably nobody needs a "better C" being possible to use C++ in procedural way, avoiding that C parts considered error prone, ugly or dangerous (i.e. using C++ string, smart pointers, etc). However, if we are talking about a different language, not a C improvement, I think Go could be the answer.
The three things I can think of are.<p>1. Eliminate all UB<p>2. Ability to strictly define memory layouts<p>3. Ability to safely construct ABI stack frames.
D with -betterC flag:<p><a href="https://dlang.org/spec/betterc.html" rel="nofollow">https://dlang.org/spec/betterc.html</a>