News for hackers. Stuff that matters.
Re:Rust support in the Linux kernel by b20000 on Wednesday December 08, 2021 @08:16PM (#29492676)
C is what you program is what you get. and i think that is pretty important.
Re:Rust support in the Linux kernel by kungito on Thursday December 09, 2021 @02:40AM (#29494842)
This is true for any programming language. The problem is being aware of what you really wrote
Re:Rust support in the Linux kernel by b20000 on Thursday December 09, 2021 @12:01PM (#29499872)
No, you are wrong. C++ is one example. I've been using that language now for about 20 years and I still don't use all of its features. It is possible to write code in that language that you assume will work a certain way but then in practice it does a lot of things you didn't think you signed up for. Recently I started using STL more, after having stayed away from it for most of my career, and the performance of my application went out the window, and I had to override all memory allocation related functions to fully understand where the problem was coming from. It's easy to use the STL and make assumptions about performance, then find out later you get a lot of issues that come with it that you never signed up for. And that is why I don't want rust in the kernel. If a language does a lot of stuff for you, there will be a price to pay.
Re:Rust support in the Linux kernel by nicoburns on Thursday December 09, 2021 @01:09PM (#29500826)
> It is possible to write code in that language that you assume will work a certain way but then in practice it does a lot of things you didn't think you signed up for

This is also possible for C. Most commonly around Undefined Behaviour. C only does what you expect it to do if you know the C spec inside out. Rust can have confusing behaviour too, but it is generally much better in this regard than C or C++.

You may find it easier to reason about C than Rust, but that's only because you know C better. I find it much easier to reason about Rust.

Re:Rust support in the Linux kernel by einpoklum on Thursday December 09, 2021 @02:50AM (#29494898)
With modern compilers, there is no such thing as what you program is what you get.
Re:Rust support in the Linux kernel by randomswede on Thursday December 09, 2021 @07:13AM (#29496480)
As long as you stay away from compiler-dependent, platform-dependent, and/or undefined behaviour, you should be fine. Main problem is that a surprising ab´mount of "looks normal" code is actually UB.
Re:Rust support in the Linux kernel by einpoklum on Friday December 10, 2021 @03:46AM (#29507805)
You would be "fine", but the compiler will optimize away alot of your code, and will rearrange a lot of the rest. I wasn't even talking about platform-dependent or undefined behavior.
Re:Rust support in the Linux kernel by pjmlp on Thursday December 09, 2021 @02:28AM (#29494797)
C is what you program is what you might get.

Know thy standard and thy compiler optmizations, least you be surprised by the outcome.