News for hackers. Stuff that matters.
Re:Rust, Zig, and the Futility of “Replacing” C by smitty1e on Sunday February 28, 2021 @04:10AM (#26291862)
My understanding is that Rust's chief innovation is the borrow checker.

If this famous device is that outstanding, one wonders at what point some version of that funtionality arrives for C or C++.

Re:Rust, Zig, and the Futility of “Replacing” C by pjmlp on Sunday February 28, 2021 @08:08AM (#26293163)
Bring the borrow checker to the masses, Cyclone, ATS, Carp did it first.

Microsoft and Google have already been collaborating in lifetime analysis on Clang Tidy and VC++ static analyser, it just isn't 100% there.

CppCon 2019: Gábor Horváth, Matthias Gehre “Lifetime analysis for everyone”"

https://www.youtube.com/watch?v=d67kfSnhbpA

Lifetime Profile Update in Visual Studio 2019 Preview 2

https://devblogs.microsoft.com/cppblog/lifetime-profile-upda...

GCC 11 will also support a lightweight version of it for C, https://developers.redhat.com/blog/2021/01/28/static-analysi...

Re:Rust, Zig, and the Futility of “Replacing” C by Rusky on Sunday February 28, 2021 @12:12PM (#26294865)
???

Rust freely declares itself to be inspired by Cyclone et al, but its capabilities are quite different from Cyclone's region analysis (and Carp actually came after Rust).

The C++ static analysis, on the other hand, is quite limited in comparison even to Cyclone. It's not sound and doesn't even aim to be- in other words, "just" another static analysis that will not catch everything. ("Just" in quotes because of course more of this is great- my point is merely that it's not the same functionality coming to C++.)

Re:Rust, Zig, and the Futility of “Replacing” C by pjmlp on Sunday February 28, 2021 @12:54PM (#26295296)
Read the comment I was replying to, before jumping into Rust advocacy mode.

> My understanding is that Rust's chief innovation is the borrow checker.

Carp was a mistake, I wanted to refer to Linear Lisp.

Also in the context of worse is better, C and C++ solutions just need to be good enough.

Learn this and advocate properly.

Re:Rust, Zig, and the Futility of “Replacing” C by Rusky on Sunday February 28, 2021 @01:02PM (#26295380)
What makes you think I'm "advocating" anything? My goal is for people to understand the state of things.

C and C++ have had static analyzers to catch "some version" of these problems for a long time now, so presumably anyone asking about borrow checker functionality would be interested in whether that functionality matches Rust's (i.e. is sound).

Re:Rust, Zig, and the Futility of “Replacing” C by pjmlp on Sunday February 28, 2021 @01:09PM (#26295471)
It reads like it.

We should not forget that even if those static analysers aren't sound, they allow to keep using 50 years of eco-system.

Which is why companies like Microsoft, despite all security talk, in the end add support for recent ISO C versions, and have "secure" platforms like Azure Sphere with a C only SDK.

Re:Rust, Zig, and the Futility of “Replacing” C by Rusky on Sunday February 28, 2021 @01:15PM (#26295557)
I don't disagree:

> ("Just" in quotes because of course more of this is great- my point is merely that it's not the same functionality coming to C++.)

Re:Rust, Zig, and the Futility of “Replacing” C by pjmlp on Sunday February 28, 2021 @02:35PM (#26296319)
We agree then, it is better than not trying to improve anything I guess.
Re:Rust, Zig, and the Futility of “Replacing” C by vlovich123 on Sunday February 28, 2021 @07:04AM (#26292791)
Likely not because a feature like that kind of has to be implemented as part of the core language. Maybe someone could retrofit a “safe” version of c/c++, but there’s nothing on the horizon that indicates that would be possible (they are hampered by back compat issues).
Re:Rust, Zig, and the Futility of “Replacing” C by smitty1e on Sunday February 28, 2021 @08:01AM (#26293106)
I mean, MyPy does have some core PEP support, but remains optional for Python.

If something as core as type checking can be an optional feature, I'd be surprised if a heftier brain than mine can't get most of the way to a C++ borrow checker optionally.

Doesn't C++ famously fetish complexity? Wasn't pi once calculated at compile-timel with a C++ template? Where is my Obfuscated C entry that looks like an ASCII Robotron game and borrow-checks, say, the Linux kernel?

Re:Rust, Zig, and the Futility of “Replacing” C by pjmlp on Monday March 01, 2021 @01:42AM (#26300278)
That is partially the reason why all big OS and CPU vendors are investing into hardware memory tagging.
Re:Rust, Zig, and the Futility of “Replacing” C by metreo on Wednesday March 03, 2021 @04:34AM (#26326366)
project verona is _one_ attempt at doing this, ebpf is another