TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Rust vs C Pitfalls

196 点作者 Anilm3超过 8 年前

10 条评论

gravypod超过 8 年前
If you&#x27;re fighting, you&#x27;ve lost. The way to convert everyone to Rust you need to be better the the competition. Not just better as in &quot;look at my features that will make your code safer&quot;. People may see the value but think &quot;I get on just fine without the borrow checker so it isn&#x27;t <i>too</i> important&quot;. You need to be far better then the replacement by providing the following:<p><pre><code> * Great Tooling ( IDEs ) * Great Libraries ( Everything and a kitchen sink ) * Better Documentation </code></pre> Anything that can be done easily in C or C++ will need to be easier in Rust for everyone to move. No amount of language features will pull people who are doing well at their job, currently building everything they need to, and who maintain low level systems. You have to be able to entierly replace the old systems in a completely feature-complete way that&#x27;s also easy to migrate to.<p>Blog posts wont pull me away from C, tooling and docs will.
评论 #13268425 未加载
评论 #13268112 未加载
评论 #13266618 未加载
评论 #13266687 未加载
评论 #13266604 未加载
评论 #13269809 未加载
评论 #13266667 未加载
评论 #13266648 未加载
评论 #13268865 未加载
评论 #13267279 未加载
评论 #13266895 未加载
评论 #13266951 未加载
michaelmior超过 8 年前
&gt; “Safe” code is guaranteed to be 100% safe. Not statistically safe. Not safe when the compiler feels like it. As long as your code compiles, it will be safe in terms of memory safety and data-race freedom.<p>As far as I am aware, the Rust compiler has not been proved correct. So whether or not your code is correct still depends on the correctness of the compiler. Of course this is probably correct, but still not 100% guaranteed.<p>Edit: Relevant discussion - <a href="https:&#x2F;&#x2F;github.com&#x2F;rust-lang&#x2F;rust&#x2F;issues&#x2F;9883" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;rust-lang&#x2F;rust&#x2F;issues&#x2F;9883</a>
评论 #13269839 未加载
sidlls超过 8 年前
The kind of safety guarantees Rust provides are, in my opinion, insufficient justification for experienced developers to move from C or C++. Rust has other features that make it generally superior in certain (many) contexts. The safety is a nice &quot;add-on&quot; effect, I suppose, but my view is that constantly hyping safety as the biggest selling point is missing a mark.
评论 #13269049 未加载
评论 #13268210 未加载
评论 #13266785 未加载
评论 #13269855 未加载
评论 #13266812 未加载
chj超过 8 年前
We are having new languages every year. Instead of debating which language is the best, why can&#x27;t we invent a way to let components implemented in different languages talk with each other easily? We have pipes, sockets and message queues, but it&#x27;s never simple enough to glue everything together.
评论 #13268744 未加载
评论 #13268199 未加载
评论 #13268204 未加载
评论 #13268454 未加载
pklausler超过 8 年前
A more interesting question for me is: is there any reason why would I want to use Rust over Haskell on any task where Haskell is &quot;fast enough&quot;?
评论 #13267193 未加载
评论 #13276233 未加载
评论 #13269588 未加载
Tempest1981超过 8 年前
Stroustrup has proposed a way to add safety to C++. It&#x27;s called &quot;C++ Core Guidelines&quot;, and &quot;GSL&quot;.<p><a href="https:&#x2F;&#x2F;isocpp.org&#x2F;blog&#x2F;2015&#x2F;09&#x2F;bjarne-stroustrup-announces-cpp-core-guidelines" rel="nofollow">https:&#x2F;&#x2F;isocpp.org&#x2F;blog&#x2F;2015&#x2F;09&#x2F;bjarne-stroustrup-announces-...</a><p><a href="https:&#x2F;&#x2F;github.com&#x2F;Microsoft&#x2F;GSL" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;Microsoft&#x2F;GSL</a><p>I watched his talk -- wondering if anyone is using it. <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=1OEu9C51K2A" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=1OEu9C51K2A</a><p>Using GSL gives adds some safety to pointers and memory allocation -- while providing the bare-metal performance that C is known for. (It still feels very low-level.)
smitherfield超过 8 年前
To play the devil&#x27;s advocate a bit, most of these are features you already get with C++, especially if you turn on all relevant warnings and treat them as errors. I can see the advantage of having things (sorta, given &quot;unsafe&quot;) statically guaranteed for a shared codebase, but what are some compelling reasons to switch for personal projects?
评论 #13275855 未加载
faragon超过 8 年前
Author forgets some inconvenients of Rust: massive bloat, multi-platform issues, etc.
评论 #13270965 未加载
gens超过 8 年前
Since this is a &quot;vs&quot; can i assume that rust is better in all regards to C ? As in that rust is flawless ? Or should it be &quot;Rust vs C&#x27;s Pitfalls&quot; ?
fungos超过 8 年前
You&#x27;re so wrong that is laughably.<p>That laughably hashing functions are highly specialized implementations for a proposed problem. There is NO MORAL there.<p>I code C for living and if we can use &quot;laughably hashing functions&quot; to gain performance we WILL DO.
评论 #13272186 未加载
评论 #13272178 未加载