3 ms·
Rust to me makes difficult things that are trivial in C. For example one thing that I don't like about Rust is the fact, that at least with the standard library
by alerighi 5y ago
Rust to me makes difficult things that are trivial in C. For example one thing that I don't like about Rust is the fact, that at least with the standard library, memory allocations are hidden in things like calling the constructor of a string. And what if a memory allocation fails?
What's the point of a memory safe language if your whole program could fail for a simple out of memory condition? With C I can allocate all the memory that I need upfront, as a static variable either global (yes, they are not the devil) or inside a single function. That way the compiler can tell me if my program will fit in memory or not.
And yes, I know that in Rust you can avoid using the standard library and you can manage the memory yourself in unsafe blocks. But... what's the point on fighting the language when you can just use C?
All the things that are said about C, it's unsafe, nowadays you have tooling, every decent compiler will warn you if you try to do stupid things.
- bsder 5y ago> All the things that are said about C, it's unsafe, nowadays you have tooling, every decent compiler will warn you if you try to do stupid things. And yet Microsoft, Mozilla, Google, etc. all peg 70% of the bugs in their C codebases as memory and pointer problems. Apparently the tooling isn't good enough to stop this.
- feanaro 5y ago> What's the point of a memory safe language if your whole program could fail for a simple out of memory condition? The point is to be able to do more complex things more easily and performantly, while also not introducing trivial security vulnerabilities like buffer overflows. > But... what's the point on fighting the language when you can just use C? The point is to learn not to fight it. At that point, the language becomes much more effective to use than C. Proper C, which is not full of holes and undefined behaviour, also feels like fighting in the beginning. Empirically, it is also a fight that is won much more rarely.