Liste des Groupes | Revenir à col advocacy |
Le 08-02-2025, RonB <ronb02NOSPAM@gmail.com> a écrit :>>
I do know there is some kind of debate
over Rust. I'm not a developer so I don't really understand what it's all
about.
The reason to move from C to Rust is for safety.
>
For example, when a developer has to manage the string "hello world". He
has to reserve enough memory to store it but not too much to avoid
wasting it. And he needs to access it, so he has a variable of twelve
octets. Yes, twelve: one octet by letter, one octet for the space and
one octet for the end of the string \0. The last one being very easy to
forget. And if the string is longer than the memory reserve to store it,
it will overwrite the value of another variable. With a lot of weird
side effects.
>
Of course, in modern C, there are possibilities to have your compiler
help you with that. But it's only an example easy to understand. There
are more subtle ways to mess up with your code. That's why C wasn't used
in embedded code, ADA was used because it's more difficult to compile,
but once compiled, you would be sure it wouldn't fail.
>
And that's the reason why Rust is chosen over C. It's difficult to
learn, but it's better at getting a secured code.
>
Now, for the controversy about Rust in the kernel is not about the
quality. It's because the C code must evolve to be able to interact with
Rust code. And that's something that hasn't been anticipated. And The
developers don't want to change their code just because their program is
called by a Rust program and not by a C program. That's the controversy.
It has nothing to do with the quality of code, it has to do with impacts
of Rust on their code.
Les messages affichés proviennent d'usenet.