this post was submitted on 21 Dec 2023
244 points (96.2% liked)
Linux
48310 readers
985 users here now
From Wikipedia, the free encyclopedia
Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).
Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.
Rules
- Posts must be relevant to operating systems running the Linux kernel. GNU/Linux or otherwise.
- No misinformation
- No NSFW content
- No hate speech, bigotry, etc
Related Communities
Community icon by Alpár-Etele Méder, licensed under CC BY 3.0
founded 5 years ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
Then we arrive at Rust as a natural outcome.
And it's of course possible to migrate to Rust from C or C++ progressively, fish has almost got it done.
Did fish migrate progressively tho? I thought they swap out everything at once as soon as the rewrite is ready
Well, they are not going to release in between, but their rewrite still "works" at each commit being a hybrid of Rust and C++.
Ah, alright
Rust isn't just a new improved version of C or C++. It's completely new and it feels completely different to use Rust. In a positive way
Guaranteed memory saftey
(notice: I am not a Rust or C/C++ expert)
Doing all that is creating a completely separate programming language from C. Rust is that programming language.
Rust does that with modules and crates.
You mean having consistent/universal style guidelines? Rust pretty much has that with rustfmt.
Safe Rust is memory safe (using things like the borrow checker), and Unsafe Rust is (usually?) separated using the
unsafe
keyword.Although Unsafe Rust seems to be quite a mess, idk haven't tried it
Rust has macros, iterators, lambdas, etc. C doesn't have those. C++ probably has those but in a really weird C++ way.
I'd say no. Programming safely requires non-trivial transformation in code and a radical change in style, which afaik cannot be easily done automated.
Do you think that there's any chance to convert from this to this? It requires understanding of the algorithm and a thorough rewrite. Automated tools can only generate the former one because it must not change C's crooked semantics.
I think there's no need to stick with one particular language. It benefits to learn more languages and bring the "good parts" of their design into your code whatever you are writing it in.
Btw It happens that I've learned a bit of RISC-V, with Rust.
Idk what the iso fuck up and I don't code enough to appreciate whatever technical debt exists in either so I am probably sound like an idiot but...
Since I do infosec, the glaring issue for me is not being memory safe.
C and C++ can't be fixed retroactively because old code must remain compatible.
If you're going to implement your own C dialect, you may as well just write a new language.
For C++ that's Rust, for C that's probably Zig (Zig will just let you import existing C files, which helps with porting). Carbon and experimental languages like Jakt may also work, it all depends on what your priorities are.
Conservatives always loose, especially in tech