| > Make that better language. Rust, Go, Swift, etc. Even C++. > There is a reason most kernels are developed in C, most databases are developed in C, most (AAA) games are developed in C. And it's not "C has the necessary mind share". The only thing that is still pretty much all C is kernels. Game engines are usually C++ (a much safer language). Databases are written in all sorts of languages. Sure the big old ones are C or C++, but that's because they are old! > But people just haven't found a practical alternative. They have. Garbage collection works in a lot of cases. Rust has its lifetime & borrowing system. C++ has proper smart pointers (finally). > It's just not practically possible to make a formalism that guards against buffer overflows here. You could make a "slice"/"buffer" datatype, but that would just just increase the line noise and keep the bugs at the countless locations of wrapping/unwrapping. I take it you haven't used Go. It has slices. They work fine. No buffer overflows. |
If you carefully read my post, you noticed C here means actually C(++). And a great majority of developers from these domains actually write C++ like this: C(++).
Rust, Go, Swift. Show me the serious kernels, databases, AAA games. Rust hasn't even descended the hype train.
Garbage collection is a bit like exceptions. It works for some cases, but not for serious engineering of long-lived applications. If you have ever written a Java application with millions of little objects, you know what I mean. For starters, we can not even afford to pay for the extra memory overhead that comes with each object. For the advanced, at some point we want the application to do exactly that: advance, instead of doing GC only.
> I take it you haven't used Go. It has slices. They work fine. No buffer overflows.
These slices all come with the (huge) overhead of adding a reference to the original runtime object, and on top of that each array access is checked. Correct?