2026年8月15日 · 星期六
● 每日更新·改变自己
Eurekar·TOP
捕捉真实世界的英语信号
25信息来源
10,829精选文章
168单词卡片
18照片图片
全部7,289口语2,071外贸4免费828帖子3,249新闻1,600hackernews812techmeme649tmz628slashdot379随笔323techcrunch305arstechnica300外刊291Cards168simonwillison100bloomberg60sethgodin50图片18youtube7

unsafe Rust is safer than C\C++

unsafe Rust比C/C++安全多了。

4chan /g/ · Anonymous · 2026-08-03 17:44 · 10 帖 · 原文 ↗

← 上一篇返回列表下一篇 →
#1 unsafe Rust is safer than C\C++ / unsafe Rust比C/C++安全多了。
Anonymous · 2026-08-03 17:44

Why so many clowns here argue that Rust lose its selling point when you use unsafe?

怎么这儿这么多小丑在嚷嚷,说一用unsafe Rust就没了卖点?

Some cases require manual memory management and Rust acknowledge that, unsafe Rust is safer and easier to debug than C\C++, your codebase could be 90% safe Rust and 10% unsafe Rust for performance, and in case you made a memory bug with unsafe you just need read 10% of your codebase, unlike C\C++ where you need to read the whole codebase to find memory bugs

有些场景就得手动管内存,Rust自己也知道这点。unsafe Rust比C/C++更安全也更好调试。你的代码库可以90%是safe Rust,10%是unsafe Rust来搞性能;万一用unsafe搞出个内存bug,你只需要翻那10%的代码,不像C/C++,找个内存bug得把整个代码库全读一遍。

图片: https://i.4cdn.org/g/1785779042910518.jpg

#2 No.109449516
Anonymous · 2026-08-03 17:48

In most software safety actually isn't something we care about at all

大多数软件里,安全性其实根本不是我们在乎的东西。

#3 No.109449517
Anonymous · 2026-08-03 17:48

>vtranny

>rust

not even going to read it

连看都不带看的。

#4 No.109449721
Anonymous · 2026-08-03 18:11

>>109449464

unsafe zig is safer than unsafe rust

unsafe Zig比unsafe Rust还安全。

#5 No.109449741
Anonymous · 2026-08-03 18:14

>>109449464

Your code might be safe tranny but how safe is your asshole from my cock?

你代码可能是安全的,死基佬,但你屁眼扛不扛得住我的屌?

#6 No.109449744
Anonymous · 2026-08-03 18:14

>>109449464

because they are, as you said, clowns. can't believe I wasted so many years falling for the tranny meme

因为他们就像你说的,就是小丑。真不敢相信我浪费了那么多年信这个死基佬梗。

#7 No.109450271
Anonymous · 2026-08-03 19:12

>>109449464

"performance" is the worst reason for using "unsafe", and indicative of someone who is still stuck, if in part only, to C tardation, or worse, C++ tardation.

拿“性能”当用unsafe的理由,这是最烂的借口,说明这人还困在C语言的蠢劲儿里,或者更糟,C++的蠢劲儿里。

#8 No.109450918
Anonymous · 2026-08-03 20:18

>>109449464

The computer is not doing some randomly generated wizard shit, it does exactly what you tell it to do. Except when high energy cosmic particles toggle a bit but rust won't help you with that.

电脑不会搞什么随机生成的魔法玄学,它就严格照你告诉它的去做。除非高能宇宙粒子翻了个位,不过那种情况Rust也救不了你。

If you write correct programs it will always do the right thing and it will be secure.

你写的程序只要是对的,那它永远都会干对的事,而且安全。

The problem is that corporations want many people to write code and there aren't that many competent people and/or they are too expensive. That's why they invented rust so even retarded people who write dogshit code can be babysitted by the compiler and forced into writing secure code. By using that language outside of a corporate environment out of free will you literally stamp yourself as retarded, as they were the very reason the language came into existence in the first place. But considering the average intelligence of troons this seems to be spot on.

问题在于,企业需要大量的人来写代码,但能干的人就那么些,而且/或者他们要价太高。所以他们发明了Rust,这样一来就算那些只会写垃圾代码的弱智也能被编译器当保姆一样盯着,逼着写出安全的代码。你要是在企业环境之外自愿用这门语言,那基本就是给自己贴上了弱智的标签,因为这语言本身就是为这个诞生的。不过考虑到那些跨性别者平均智商也就那样,这倒也挺对味的。

#9 No.109450926
Anonymous · 2026-08-03 20:19

C isn't unsafe. You're just a retarded trannygrammer.

C语言本身没不安全。只是你是个弱智跨性别程序员而已。

#10 No.109451455
Anonymous · 2026-08-03 21:14

>>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没想搞得更简单或更平易近人。它在难度上相当不妥协,正因如此才把一堆人给筛掉了。

← 上一篇返回列表下一篇 →

(如果你觉得这篇文章有启发,可以点击这里付费