News for hackers. Stuff that matters.
Re:Rust-GPU: Making Rust a first-class language and ecosyste... by echelon on Saturday October 24, 2020 @12:58AM (#24877064)
C++ has a ton of baggage and is a very difficult language to use. There are too many language features and they all have years of warts.

Imagine PHP, but not memory safe. Mistakes cause segfaults, memory leaks, and can enable attackers write memory they shouldn't be able to access. To top it off, a lot of libraries are still written in "PHP4 style" and you've got to make use of them. C++ is really hard.

Both C and C++ require consideration of memory semantics, and they are both "hard" in this sense. You have to allocate and free memory deliberately and be conscious about what memory you're passing around. C is much simpler in design than C++. It doesn't have as many features, so it's harder to trip over. It doesn't necessarily make it easier to program, though.

Rust targets the same domains that C and C++ do: systems programing (operating systems and drivers), real time programming (robotics and control software), graphics and games, etc. These are places where explicit memory management is important. Rust does so while being much easier to write. The language leverages new programming language theory and design to protect memory from being written incorrectly. The memory semantics are baked into the language design and checked at compile time. Bad code (in terms of memory and async) simply doesn't compile.

Rust does this while being just as fast as C and C++.

In addition, Rust has a ton of modern features that make it feel like Ruby. Functional idioms, zero-cost abstractions, a modern trait-based type system, generics, macros, and a beautiful package manager and package ecosystem that is better than Ruby and npm.

Rust is going to beat both of these languages.

Re:Rust-GPU: Making Rust a first-class language and ecosyste... by tcoff91 on Saturday October 24, 2020 @03:24AM (#24877560)
IMO C++ despite its warts is easier to avoid mismanaging memory than C. RAII and smart pointers are very useful. Fewer off by one errors leading to buffer overflows as well in my experience due to things like iterators.
Re:Rust-GPU: Making Rust a first-class language and ecosyste... by papaf on Saturday October 24, 2020 @07:36AM (#24878542)
Rust is going to beat both of these languages.

I think looking at this as a battle is not helpful to understanding the situation. In order to supplant C/C++, Rust (and Rust programmers) will need to operate in harmony with the existing ecosystem for decades.

This interoperability means that Rust programmers will need to also be good C/C++ programmers. Its not a binary OR, its more like diffusion.

Just as an example, the primary (or earliest) use of Rust is in Firefox. But Firefox is still a C++ project.