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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Ask HN: C, C++, or Rust which language to learn next?

15 点作者 backslash_16超过 9 年前
I&#x27;m mostly new to C (have gone through about half of Learn C The Hard Way) and completely new to C++ and Rust. For my day job I use C#, JavaScript, SQL, and a little Python.<p>I got the Bjarne Stroustrup book Programming: Principles and Practice Using C++ as a gift and now I&#x27;m trying to figure out if I should keep digging into C, jump ship to learning C++ or take a look at Rust.<p>I started learning C because I wanted to dig into a non GC language and get a little &quot;closer to the metal&quot;, not because I need it for my day job. My friend got me the C++ book because he said I should spend my time learning a language that I might end up using in a job but that&#x27;s not my primary concern right now.<p>Lastly I started looking at Rust because the HN search (https:&#x2F;&#x2F;hn.algolia.com&#x2F;?query=rust%20c&amp;sort=byPopularity&amp;prefix&amp;page=0&amp;dateRange=all&amp;type=story) returned a lot of interesting comparison beween it and C&#x2F;C++. They all make it sound like Rust is an easier to learn systems language which lowers the chance of making memory related errors and has a few nice features to make the code easier to read and understand.<p>Does anybody have opinions on which language I should learn for the purpose of understanding how code interacts with the computer at a low level better, manual memory management, and learning how to deal with pointers (instead of C#&#x2F;Java references)? Any personal preference out of all the languages?

11 条评论

jbandela1超过 9 年前
Learn C++. You will have the opportunity to learn low-level features but know how to wrap them up inside highly performant, high-level components.<p>Rust is interesting, but I think it will remain an interesting language outside the mainstream without any major commercial backers (Mozilla does not count). In addition, C++ is taking a lot of the ideas from Rust and incorporating them along with tooling that will provide 95+% of the value of Rust while still keeping the advantages of C++ (see <a href="https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=hEx5DNLWGgA" rel="nofollow">https:&#x2F;&#x2F;www.youtube.com&#x2F;watch?v=hEx5DNLWGgA</a>)<p>What is interesting with C++ is that although a lot of vendors are pushing their own languages - Microsoft with C#, Apple with Swift, Google with Go, Facebook with Hack, Mozilla with Rust - they are all deeply involved with C++ because C++ powers their mission-critical code. Another way of putting it would be that despite all the promotion if all of Mozilla&#x27;s Rust code were eliminated tomorrow nobody would notice, but if all of Mozilla&#x27;s C++ code were eliminated, it would cease to exist.<p>Also, C++ is rapidly evolving and by learning Modern C++ 14 now, you can avoid a lot of the mistakes of C++ that were common in the past and write safe, elegant code. C++ is also experiencing a renaissance (see <a href="https:&#x2F;&#x2F;www.jetbrains.com&#x2F;cpp&#x2F;cpp-today-oreilly&#x2F;" rel="nofollow">https:&#x2F;&#x2F;www.jetbrains.com&#x2F;cpp&#x2F;cpp-today-oreilly&#x2F;</a>). C++ is now the one high-level language that is natively supported by the system vendor across Windows, Linux, Mac, iOS, Android, Windows Phone, XBox, and Playstation.
评论 #10716076 未加载
elbows超过 9 年前
For your purposes I would recommend C. It&#x27;s a very small language with very little abstraction, so it forces you to really understand pointers and memory layout.<p>Rust is more complicated than C and it tends to insulate you from the low-level details. The way it combines low-level control with high-level abstractions is really interesting, but from an educational point of view I think you&#x27;d get more out of it after you understand C pretty well.<p>C++ is a giant, sprawling mess. It can be very useful but I&#x27;m not sure what it will teach you other than how not to design a language. :)
nostrademons超过 9 年前
Assuming your purpose is <i>learning</i> rather than writing a practical project, I would go in the order of C =&gt; C++ =&gt; Rust. Each of them builds on concepts of the previous.<p>It is easier to learn C++ if you already know the distinction between value vs. pointer types, if you&#x27;re already familiar with C syntax, if you already know how to manage memory manually, and if you already know how to use functions, function pointers, and opaque types to create an API. C will teach you all of those.<p>It is easier to learn Rust if you already know about RAII, ownership, generics, both run-time and compile-time polymorphism, and move semantics. C++ will teach you all of those (in its C++11 and C++14 variants, at least).
评论 #10706650 未加载
评论 #10706887 未加载
评论 #10707122 未加载
dpc_pw超过 9 年前
C. Learning C is like being dropped on island and having to learn all the skills necessary to survive. After you master C, you go back to civilization and enjoy the simple life conveniences again, while being able to see through them at the real, crude and dangerous reality.<p>After you learn C, go to Rust. Rust will just teach you more than C++.
_RPM超过 9 年前
I believe C is the most important language to know. It&#x27;s pretty low level and doesn&#x27;t provide you with much, but learning what is taken for granted in higher level languages is valuable.
mbrodersen超过 9 年前
Learn C. Then you ACTUALLY 95% understand how things work. If you want to understand 100% then learn Assembler. Assembler is surprisingly simple once you get it.
untothebreach超过 9 年前
I don&#x27;t think you need to learn C and C++ as a prerequisite for learning Rust, but I still think C is worth learning. The concepts that you would learn with C++ can be learned just as well by learning Rust, so I would skip C++ if I were you.<p>If you decide to learn Rust, the Book[1] is, I think, the best way for you get started, seeing as you already have experience programming.<p>1: <a href="http:&#x2F;&#x2F;doc.rust-lang.org&#x2F;book&#x2F;" rel="nofollow">http:&#x2F;&#x2F;doc.rust-lang.org&#x2F;book&#x2F;</a>
评论 #10715601 未加载
tmaly超过 9 年前
start with C. If you look at the programming language benchmarks, it is still one of the fastest. <a href="http:&#x2F;&#x2F;benchmarksgame.alioth.debian.org&#x2F;" rel="nofollow">http:&#x2F;&#x2F;benchmarksgame.alioth.debian.org&#x2F;</a><p>if you look at the C++ code on there, much of it is written in the style of C. If you can write newer code and do not have to maintain old code, C++ would be a good second. There are still tons of high paying jobs for C++. Some pay 400K+ in the NYC area
评论 #10712451 未加载
tjr超过 9 年前
I&#x27;m currently starting a new project in C++, because various logistics conspire together to make that the ideal choice. If that weren&#x27;t the case, well, I personally do not like C++ much, though sticking with C++11 style over older C++ paradigms seems like an improvement.<p>Just picking a low-level systems language for my own fun and edification, I&#x27;d still learn C because it is so ubiquitous, but I for one hope that something more like Rust is the future.
sudeepj超过 9 年前
I am a C++ developer and I would recommend Rust. By learning Rust my C++ development practices have improved when it comes to memory management.
Arzh超过 9 年前
I think C, it will help you learn all the rest. It also allows you to see how much some stuff like concatenating strings really cost in terms of performance. I think just knowing that as a fact will help you in writing in higher level languages.