News for hackers. Stuff that matters.
Re:A Guide to Undefined Behavior in C and C++ (2010) by otabdeveloper2 on Sunday November 04, 2018 @03:11AM (#18374833)
"Undefined behavior" in C++ just means stuff that's either CPU-specific or compiler-specific.

Rust has no undefined behavior because it only supports one CPU and has only one compiler implementation.

When Rust supports a dozen architectures and has three different compiler implementations then Rust will be just as full of UB as C++. Except with the added "bonus" of all the UB being brand-new and unspecified, unlike the well-known portability pitfalls of C++.

Re:A Guide to Undefined Behavior in C and C++ (2010) by pcein on Sunday November 04, 2018 @03:52AM (#18374933)
I am happily running Rust generated code on my ARM microcontrollers. Rust uses LLVM for code generation and can support any architecture which LLVM supports.
Re:A Guide to Undefined Behavior in C and C++ (2010) by steveklabnik on Sunday November 04, 2018 @04:47AM (#18375078)
> When Rust supports a dozen architectures

"Rust now available on 14 Debian architectures" https://lists.debian.org/debian-devel-announce/2018/11/msg00...

Re:A Guide to Undefined Behavior in C and C++ (2010) by pjmlp on Sunday November 04, 2018 @04:12AM (#18374984)
There are plenty of system languages with a very tiny percentage of UB vs all the languages that allow for copy-paste of C code.

Because they prefer to loose a couple of ms to paying the price of the ultimate performance might bring.

Like in real life you can speed at 300 KMH with a 1200cc motorbike, or doing it a car with reinforced structure wearing seatbelts and airbags.

Even with diminished chances of survival, I rather be in the car.

Re:A Guide to Undefined Behavior in C and C++ (2010) by otabdeveloper2 on Sunday November 04, 2018 @04:23AM (#18375021)
UB is an implementation issue, not a language issue. UB is a fact of life that cannot be removed by overspecifying a language -- if your language spec has too much implementation-specific stuff in it, then compiler writers will simply ignore it. Many such examples. The best you can do is to document the implementation-specific stuff extensively.

Also, implementation-specific details aren't always about maximizing performance. Compilers implement languages slightly differently because of architecture and OS differences and because it's easier that way for the people writing compilers.

Re:A Guide to Undefined Behavior in C and C++ (2010) by pjmlp on Sunday November 04, 2018 @04:35AM (#18375049)
UB is not implementation specific at all, the ISO documentation is quite clear about which is which.

Other systems languages manage to do it quite well.

It was really a shame that Bell Labs gave UNIX away for a symbolic price during 10 years before being allowed to actually sell it.

We wouldn't be having this kind of C related talks.

Re:A Guide to Undefined Behavior in C and C++ (2010) by dagenix on Sunday November 04, 2018 @03:44AM (#18374913)
> Rust has no undefined behavior because it only supports one CPU ...

That is not true. Rust works on multiple architectures.

Re:A Guide to Undefined Behavior in C and C++ (2010) by otabdeveloper2 on Sunday November 04, 2018 @04:24AM (#18375023)
There's a massive chasm between "works on" and "supports".
Re:A Guide to Undefined Behavior in C and C++ (2010) by Retra on Sunday November 04, 2018 @11:20PM (#18379843)
That doesn't seem relevant -- Rust works on and supports multiple architectures. And there's plenty of UB in unsafe code.