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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Why You Should Know C++

31 点作者 ArturSoler大约 16 年前

17 条评论

kristiandupont大约 16 年前
Wow, I like C++ (at least, more than most), but I don't agree on any of those points.<p>In fact, I am sad to say that unless your job requires it, I can't really think of any reason to learn the language. It relies on a mixture of paradigms that are easier learned from other languages where they are isolated. And for lolevel stuff, you are better off learning C.
评论 #618385 未加载
评论 #618320 未加载
评论 #618469 未加载
评论 #618342 未加载
cousin_it大约 16 年前
I'll go for a point-by-point critique.<p>Point 1 tacitly assumes that learning C++ not only teaches you a common subset of many other popular languages, but also is the easiest way to learn said subset. This is wrong: a lot of simpler languages can teach you the same, e.g. JavaScript or pre-1.5 Java.<p>Point 3 says a given code sample in the wild has higher probability of being in C++ than any other language. This clashes with my impressions.<p>Point 4 assumes that the main difficulty of C++ is due to pointers and manual memory management, and that knowing your way around those issues will help you in other programming areas anyway. This sounds wrong to me: C shares those "difficulties" with C++ and isn't generally regarded as a hard language. The difficulty of C++ mostly stems from design decisions unique to C++ and useless elsewhere, like template metaprogramming or the dangerous combination of manual memory management with exception handling.<p>Point 5 implies that C++ invented parametric polymorphism and that this facility is essential to make algorithms work on a variety of data types. Wrong on both counts: ML and Ada generics predate C++, and Smalltalk-like dynamically typed languages solve the same problem without type parameterization.<p>Point 6 assumes more libraries have C++ interfaces than C interfaces, which is wrong by an order of magnitude at least.<p>Point 9 assumes most programmers are more interested in performance-oriented and algorithmically complex projects. Can't give statistics here, but I'm a data point to the contrary: I love UI and frontend work.<p>Point 10 is valid.<p>My own reasons for knowing C++ are a combination of point 10 and the need to muck around with <a href="http://mapnik.org" rel="nofollow">http://mapnik.org</a> - the only C++ library I ever found useful. And its code sucks, I'd kill for a C/Python alternative.
sprachspiel大约 16 年前
My reason not to learn C++: There are so many things one should know, that it is not rational to learn all the arcane details of C++. Every decision to learn something is an implicit decision not learn everything else.
评论 #618772 未加载
joezydeco大约 16 年前
No discussion of C++ should go without mentioning the C++ FQA (Frequently Questioned Answers). It carefully explains every single thing wrong with the language, and there's a LOT to explain.<p><a href="http://yosefk.com/c++fqa/" rel="nofollow">http://yosefk.com/c++fqa/</a><p>Skip to <a href="http://yosefk.com/c++fqa/defective.html" rel="nofollow">http://yosefk.com/c++fqa/defective.html</a> for a great overview. And if anyone ever mentions "templates" again I'm gonna smack them hard.
mooism2大约 16 年前
3. Code samples in books are more likely to be in Java or Python than C++.<p>6. Libraries are more likely to have native C bindings than native C++ bindings.
评论 #618318 未加载
评论 #618335 未加载
tocomment大约 16 年前
Life is too short for c++. That's what I always say (even at job interviews..)
评论 #618683 未加载
tptacek大约 16 年前
I agree with everything but (1), (5), and (10).<p>(1) Other languages may be influenced by C++ (especially at a syntactic level, and, superficially, in their object models). But those other languages are far easier to learn and become facile with than C++ is. Point (1) advocates for learning languages in the wrong order.<p>(5) Templates and generic programming are just tools to mitigate the badness of C++.<p>(10) Though a majority of the smartest hackers I've worked with know C, a minority of them are C++ developers. And that still leaves plenty of room for smart people who know neither language.
plinkplonk大约 16 年前
"You will hardly be seen as a hacker if you don’t know C++"<p>Yeah right! You are "seen as a hacker" if you write code that is useful to others and/or is brilliant in some respect. Nothing to do with knowing a particular language.<p>If knowledge of a specific language <i>is</i> a criterion, I'd rather have someone be an expert in C/lisp/smalltalk/haskell/prolog.... C++ originates or embodies no concepts that weren't discovered or done better elsewhere.<p>e.g: An expert smalltalker is more likely to understand OO than a C++ programmer.
jcromartie大约 16 年前
&#62; your reputation as a programmer will be lower if you don’t know it<p>I <i>could</i> learn C++, or I could learn Smalltalk, Scheme and Haskell in the same time and mental space.
dhotson大约 16 年前
I like to use C++ just as a better C.<p>Things like single line // comments and not having to declare all your variables at the top of your functions is really useful.<p>STL is also really useful in that you don't have to (badly) reinvent basic data structures like vectors and maps. Of course, STL also means reading compiler errors that are pages long... :-/
评论 #618376 未加载
评论 #618354 未加载
评论 #618382 未加载
评论 #618361 未加载
kwamenum86大约 16 年前
In the context of code sampled, the difference between Java and C++ (and PHP and Javascript and a few others) is trivial and will hardly affect your understanding of the code. These are all part of a family of languages with C-style syntax.
bigsassy大约 16 年前
When I first started programming, people would say the same kind of things for learning some form of assembly. 10 years from now people will probably be making an article like this for Java and C#.
utx00大约 16 年前
really? with python/ruby/clojure/erlang/lua/js coming up in the world? ... i thought this was going to be a 1991 article.
screwperman大约 16 年前
I feel the most compelling reason to use C++ is that it is one of the de facto programming languages in competitions.
评论 #618388 未加载
swolchok大约 16 年前
Didn't we do this discussion already when the last C++ article was posted?
known大约 16 年前
Wall Street runs on C++.
sectorzero大约 16 年前
If you want to be a master of the machine use C/C++; if you want to be a slave use Java; If you want to be a slave of a slave then its C# for you. Simple :)<p>( Disclaimer : My comments are limited to only the above 'popular' languages in discussion. Also I program purely on *nix, so I am not aware of your other dark or better worlds out there )