Live data from Hacker News

Rust Language, and Why C/C++ Will Never Die (2015)

viva64.com

41–50 of 66 posts

Re: Rust Language, and Why C/C++ Will Never Die (2015)

#41

Wow that's a long article, I tried summarizing the main points. I think some of them have merit, but for the "technical reasons", I don't think I agree on most. Here are the points: 1 - there's a ton of existing c++ programs 2 - other have tried replacing c++ and failed (D for instance) 3 - no one will use Rust until it has cool IDE stuff and production ready libraries: a chicken and egg problem that Go was able to s…

> rust is not that fast I thought Rust was pretty competitive with C++ in this respect?

it always was, but at the time the article was written simd instrinics were missing.

Re: Rust Language, and Why C/C++ Will Never Die (2015)

#43
post #33

I really wish people would just forget about unsafe ("unsafe" as in Ruby is much safer) languages completely and embrace languages with safe run times. Rust, C, C++, Go and many more languages all need to "die" and be replaced with high-level languages; Lisp, Python, Ruby, Javascript, etc. I guess the fanboys will complain for me calling Rust unsafe. You can write "safer" programs in Rust just like you can in C++. Th…

And how, might I ask, are you going to write your runtime for all these safe languages?

Re: Rust Language, and Why C/C++ Will Never Die (2015)

#44

Wow that's a long article, I tried summarizing the main points. I think some of them have merit, but for the "technical reasons", I don't think I agree on most. Here are the points: 1 - there's a ton of existing c++ programs 2 - other have tried replacing c++ and failed (D for instance) 3 - no one will use Rust until it has cool IDE stuff and production ready libraries: a chicken and egg problem that Go was able to s…

> rust is not that fast I thought Rust was pretty competitive with C++ in this respect?

I have to say that most "Rust is fast" articles I read stop at comparing microbenchmarks written with not much care on performance. I really want to see some comparisons in highly-optimized cases like linear algebra library (Eigen) or game engines with things like stack-local allocators or even using alloca() built upon EA STL/Folly.

Re: Rust Language, and Why C/C++ Will Never Die (2015)

#45
post #33

I really wish people would just forget about unsafe ("unsafe" as in Ruby is much safer) languages completely and embrace languages with safe run times. Rust, C, C++, Go and many more languages all need to "die" and be replaced with high-level languages; Lisp, Python, Ruby, Javascript, etc. I guess the fanboys will complain for me calling Rust unsafe. You can write "safer" programs in Rust just like you can in C++. Th…

Alternatively, Python could easily be argued as being radically unsafe compared to Rust, given the many, many libraries that call out to C and the ease of exploiting C libraries loaded by CPython. https://hackernoon.com/python-sandbox-escape-via-a-memory-co... I'd say more people have had to jump into "unsafe" Python than have had to jump into "unsafe" Rust. As for overflow checking, that won't lead to unsafety on it…

Saying that wrap around doesn't lead to unsafety because "it is defined that way" is wrong. Wrap around is one of the leading causes of security issues in all software. Scroll down to the Quantifying the risk in the blog post. The author says that it is very hard not easy to exploit C libraries loaded by Python.

Re: Rust Language, and Why C/C++ Will Never Die (2015)

#46
post #45

Earlier quoted context omitted.

Alternatively, Python could easily be argued as being radically unsafe compared to Rust, given the many, many libraries that call out to C and the ease of exploiting C libraries loaded by CPython. https://hackernoon.com/python-sandbox-escape-via-a-memory-co... I'd say more people have had to jump into "unsafe" Python than have had to jump into "unsafe" Rust. As for overflow checking, that won't lead to unsafety on it…

Saying that wrap around doesn't lead to unsafety because "it is defined that way" is wrong. Wrap around is one of the leading causes of security issues in all software. Scroll down to the Quantifying the risk in the blog post. The author says that it is very hard not easy to exploit C libraries loaded by Python.

> Wrap around is one of the leading causes of security issues in all software.

A wrap around on its own can not cause unsafety in rust, only panics.

As in, maybe you try to use the wrapped integer as an array index, that's still safe even if it wraps (because Rust bounds checks).

It would only case memory safety when used alongside code in an unsafe block.

> The author says that it is very hard not easy to exploit C libraries loaded by Python.

I drew a different conclusion from that section

Re: Rust Language, and Why C/C++ Will Never Die (2015)

#47
post #33

I really wish people would just forget about unsafe ("unsafe" as in Ruby is much safer) languages completely and embrace languages with safe run times. Rust, C, C++, Go and many more languages all need to "die" and be replaced with high-level languages; Lisp, Python, Ruby, Javascript, etc. I guess the fanboys will complain for me calling Rust unsafe. You can write "safer" programs in Rust just like you can in C++. Th…

And how, might I ask, are you going to write your runtime for all these safe languages?

https://en.wikipedia.org/wiki/Bootstrapping_(compilers)

Re: Rust Language, and Why C/C++ Will Never Die (2015)

#48
C (and, to a lesser extent, C++) absolutely will die. The way the languages are managed guarantees this.

It's a myth that garbage collection is slow, and it's furthermore a myth that manual memory management is easy. So C (and, to a lesser extent, C++) will continue to lose ground for new projects to languages that take the requirement to manage memory off the programmer.

Furthermore, while C and C++ require low-level attention to detail in managing memory, they prohibit many low-level manipulations that you might want to use them for, if you're implementing e.g. an operating system kernel or a language runtime, by assigning them 'undefined behavior'. The C or C++ abstract machine, according to the actual language standard enforced by the compilers, is not noticeably closer to even the PDP-11 abstract machine than, say, Haskell's. (Haskell also has raw pointers, it also allows arithmetic on them, it also allows them to be converted to and from integers, and, in practice, any portable, defined-behavior low-level C code is going to end up using operations remarkably similar to what Haskell allows.)

So C (in particular) is too low-level for application code, but too high-level for system code; there is no realm where C is advisable for a new project. That leaves maintaining existing programs.

The problem here is that C and C++ long (10 years or more) ago abandoned the original X3J11 mandate to 'keep most existing programs working', in favor of aggressively using undefined behavior for optimizations. You can't keep breaking your existing programs without convincing some of their maintainers that re-writing in a new language is a better option, and without new programs that means that C and C++ will, inevitably, die, when the last program written in them is either abandoned or re-written after the compilers (yet again) break them with a new 'optimization'.

Re: Rust Language, and Why C/C++ Will Never Die (2015)

#49
post #45

Earlier quoted context omitted.

Saying that wrap around doesn't lead to unsafety because "it is defined that way" is wrong. Wrap around is one of the leading causes of security issues in all software. Scroll down to the Quantifying the risk in the blog post. The author says that it is very hard not easy to exploit C libraries loaded by Python.

> Wrap around is one of the leading causes of security issues in all software. A wrap around on its own can not cause unsafety in rust, only panics. As in, maybe you try to use the wrapped integer as an array index, that's still safe even if it wraps (because Rust bounds checks). It would only case memory safety when used alongside code in an unsafe block. > The author says that it is very hard not easy to exploit C…

> A wrap around on its own can not cause unsafety in rust, only panics.

You are either misinformed or do not know what safety means. Integer types in Rust in release mode wraps around and that can lead to consequences much worse than crashing. Programs doing the exact opposite of what they were intended to.

Now I see that you are talking about MEMORY safety which I'm not. Writing safe programs includes so much more than just memory safety.

> I drew a different conclusion from that section

I have not seen a single CVE about the issue.

Re: Rust Language, and Why C/C++ Will Never Die (2015)

#50
post #49

Earlier quoted context omitted.

> Wrap around is one of the leading causes of security issues in all software. A wrap around on its own can not cause unsafety in rust, only panics. As in, maybe you try to use the wrapped integer as an array index, that's still safe even if it wraps (because Rust bounds checks). It would only case memory safety when used alongside code in an unsafe block. > The author says that it is very hard not easy to exploit C…

> A wrap around on its own can not cause unsafety in rust, only panics. You are either misinformed or do not know what safety means. Integer types in Rust in release mode wraps around and that can lead to consequences much worse than crashing. Programs doing the exact opposite of what they were intended to. Now I see that you are talking about MEMORY safety which I'm not. Writing safe programs includes so much more t…

> Now I see that you are talking about MEMORY safety which I'm not. Writing safe programs includes so much more than just memory safety.

Yes, what rust claims is memory safety, not safety from all forms of bugs. If you don't want wrapping integers, you can compile with a flag to panic on overflow, or use types in std that will have the behavior you want.

> I have not seen a single CVE about the issue.

That's part of the point of the article. CVEs are rarely filed for memory safety issues in the underlying C libraries that make up the Python ecosystem.

Post reply on HN