>>109449464
unsafe Rust is actually marginally more difficult to write than C because it has more strict undefined behavior. But it doesn't matter because if you really need unsafe you probably know what you are doing and still benefit tremendously from having rest of your safe code statically checked for safety.
其实unsafe Rust写起来比C还难一点,因为未定义行为更严格。但这无所谓,因为真要写unsafe的话你心里大概清楚自己在干嘛,而且其余safe代码能通过静态检查保证安全,好处依然巨大。
>>109450271
General purpose containers is the common place of unsafe for performance sake, but if you aren't a CS student, you very rarely need to implement one.
通用容器是出于性能写unsafe的常见场景,但你要不是学CS的,基本很少需要自己实现一个。
>>109450918
The reason you have types, function signatures and structures is because writing correct programs using nothing but integers and pointers is very error prone. A competent programmers can still make errors and his performance will nose dive if he needs to constantly check documentation of what register holds what at what point.
之所以有类型、函数签名和结构体,是因为光靠整数和指针写正确程序太容易出错了。就算是个靠谱的程序员也可能犯错,而且要是他得不停翻文档查某个寄存器在哪个阶段存着什么,效率也会直线下降。
Rust doesn't do anything fundamentally different than any other high level language. Just like C that has types and checks for type safety, Rust also tracks lifetimes and checks for borrows. Lifetime is just a different kind of type(literally) and borrow checker is the lifetime counterpart of a type checker.
Rust跟其他高级语言相比并没有什么本质上的不同。就像C有类型检查一样,Rust也跟踪生命周期并检查借用。生命周期说白了就是另一种类型,而借用检查器就是生命周期版的类型检查器。
>That's why they invented rust so even retarded people who write dogshit code
>所以他们发明了Rust,这样一来就算那些只会写垃圾代码的弱智
That's Go, not Rust. Rust doesn't try to be simpler or more approachable. It's rather uncompromising in terms of difficulty and that's why it filters out so many people.
那是Go,不是Rust。Rust没想搞得更简单或更平易近人。它在难度上相当不妥协,正因如此才把一堆人给筛掉了。