3 ms·
> C++ has implicit allocation Ah, but see, it doesn't. Linus was wrong about many things in his rant. This being one of them. Now the standard library does in
by kllrnohj 5y ago
> C++ has implicit allocation
Ah, but see, it doesn't. Linus was wrong about many things in his rant. This being one of them.
Now the standard library does indeed have things that do implicit allocations, such as std::string. But these, like with Rust, are distinct from the language & replaceable. Would it be effort to make a kernel-safe std:: replacement? Yes. Would it be a lot of work? Not really. And it's the kind of thing Linux has been doing for decades with C anyway. It's not like they use a standard libc implementation (much less a rich libc implementation like glibc), for example.
And it's something game devs have been doing with C++ for decades without any issues, too.
So for this one you don't even have to ban anything. Just don't pass a standard library implementation to the compiler. It doesn't come with one, after all. You have to add it. So you could just... Not do that.
As for nobody did the work... That's true. But Linus also pretty much nuked the entire concept of using C++, regardless of the what or how. Time seems to have changed his mindset on some of those things, hence his reaction to Rust, which largely makes all this moot. But we shouldn't confuse short term politics with technical issues, either.
- Galanwe 5y ago> Linus was wrong about many things in his rant. This being one of them. Its not what is being discussed here. C++ has an implementation defined memory model. That just cannot work with Linux out of the box. You need an OS and compiler designed from the ground up to handle this.
- kccqzy 5y agoC++ has a well defined memory model: https://en.cppreference.com/w/cpp/language/memory_model https://en.cppreference.com/w/cpp/language/memory_model And it's not that different from the C memory model. How did Linux work with C?
- Galanwe 5y ago> C++ has a well defined memory model Only since C++11, and it's not a full blown memory model.
- jcelerier 5y agoit's defined enough for C to have adopted it since C11 (https://people.mpi-sws.org/~viktor/papers/cpp2015-invited.pdf https://people.mpi-sws.org/~viktor/papers/cpp2015-invited.pd...)
- gpderetta 5y agoC++ has with a close, approximation, the same memory model as C, both concurrent and otherwise. In fact C11 just adopted the C++11 concurrent memory model wholesale.