TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask YC: C++

21 pointsby kashifabout 17 years ago
Folks, I am a Pythonista, and need to learn C++ in a hurry. I have almost negligible familiarity with the language. In a months time I want to be able to hack basic apps in the Symbian C++ environment.<p>I am looking for suggestions for good books for C, C++, STL and Symbian. Please let me know what you think is the best course of action. Also any advice from your experience is appreciated.<p>PS: What do you think of C++ as a language?

26 comments

txabout 17 years ago
C++ feels like a Japanese sportbike for small projects: your code will run crazy fast and it's easy to kill yourself if you're not good enough at it.<p>When your project grows beyond a certain size, C++ starts to feel like early soviet ballistic rockets: plenty fast, but a nightmare to maintain while on the ground, take forever to prepare to launch and can explode at any moment while in flight.<p>I used to <i>love</i> it, up until I bought a Pentium-III 800Mz with 512MB of RAM somewhere around 2001.
评论 #165327 未加载
评论 #165376 未加载
yummyfajitasabout 17 years ago
&#62; PS: What do you think of C++ as a language?<p>I hate C++, although I'm using it right now since python lacks libraries I need (<a href="http://www.cgal.org/" rel="nofollow">http://www.cgal.org/</a>).<p>But I hate C++/STL/Boost far less than I hate C++. The STL and Boost make C++ feel almost like statically typed python, (while occasionally driving you mad with pages full of template errors).<p>An example (g is a graph):<p><pre><code> list&#60;Edge&#62; to_remove; BOOST_FOREACH( Vertex v, vertices(g)){ if (degree(v,g) &#62; 2){ //Try to remove some ambiguity BOOST_FOREACH(Edge e, out_edges(v,g)) { ...Do some euclidean geometry... if (...Geometric constraint not satisfied...){ to_remove.push_back(e); } } } } BOOST_FOREACH(Edge e, to_remove){ remove_edge(e,g); } </code></pre> This is almost a direct translation of what I'd write in python (if python had graphs as a data structure), except of course that to_remove is a list <i>of edges</i>.<p>Some people insist on programming C++ like it is c. I.e., they will build an <i>array</i> (hoping it's big enough, sometimes they will even error check if it's not), cast the edges to int's, keep track of how many array members represent edges and how many do not. If you do that, your life will suck.
评论 #165229 未加载
评论 #165250 未加载
评论 #165184 未加载
copenjaabout 17 years ago
First:<p>Accelerated C++ by Andrew Koenig and Barbara E. Moo<p><pre><code> -Great book aimed at absolute beginners written by top of the line experts. Koenig worked at AT&#38;T and was a major player in the C++ standards committee. </code></pre> Second:<p>Effective C++ by Scott Meyers<p><pre><code> -This book is spectacular and will take you from beginner to the next level. It is very well written and an easy read. More Effective C++ and Effective STL are also good. </code></pre> Reference:<p>The C++ Programming Language Bjarne Stroupstrup<p><pre><code> -This should be your reference book. </code></pre> If you want some Guru level references I can list a couple more advanced books if your interested...
评论 #165453 未加载
评论 #165418 未加载
mpfefferleabout 17 years ago
This is the book I learned Symbian/C++ on: <a href="http://www.amazon.com/Developing-60-Applications-Developers-Developer/dp/0321227220/ref=pd_bbs_1?ie=UTF8&#38;s=books&#38;qid=1208352191&#38;sr=8-1" rel="nofollow">http://www.amazon.com/Developing-60-Applications-Developers-...</a><p>It's a bit out of date and it focuses on Nokia's application framework (Series 60). It should be enough to get you writing basic applications though. If you're going to stick with Symbian, don't worry about C or STL. They don't use them.<p>I assume you're going to be using the more recent Symbian 9. Unfortunately, I don't have any books to recommend for this version. You'll need to rely on the Nokia/Symbian docs for Symbian 9 specific features like Platform Security.<p>Since you're new to C++, I'd recommend following Symbian's naming conventions religiously. They were very helpful when I was a C++ noob just starting out.<p>I haven't worked on Symbian in about a year, but if you have any questions, drop me a line (email's in the profile). I'll see what I can do.
评论 #165186 未加载
评论 #170745 未加载
评论 #165180 未加载
wheelsabout 17 years ago
"C++ Primer", by Stanley Lippman, Addison Wesley<p>That's probably the best introduction book. It's super-long, but after you've worked with C++ for a while you'll understand why. "The C++ Programming Language" has been mentioned here a couple of times, and it's invaluable to have as a reference later in your C++ career, but is almost impenetrable as a book for learning the language.
评论 #165340 未加载
wavesplashabout 17 years ago
Download a copy of Bruce Eckel's Thinking in C++. He's superb at bringing to light the quirks of each language he writes about.<p><a href="http://www.mindview.net/Books/DownloadSites" rel="nofollow">http://www.mindview.net/Books/DownloadSites</a>
hchoabout 17 years ago
Symbian C++ is a different beast. It is heavily design pattern oriented, so it is a good idea to ger comfortable with things like active objects,publish and subscribe, client-server, factory, singleton, etc, etc...<p>Obviously, get the SDK, demo apps and start experimenting with it, as you would do with any other technology.<p>Do you mind if I ask why you need to hack in Symbian C++?
评论 #165147 未加载
评论 #165183 未加载
abstractwaterabout 17 years ago
I also had to learn C++ fast, and "Accelerated C++", by Andrew Koenig and Barbara E. Moo was great. The book assumes you are a programmer, it's not dumbed down and most importantly it's only around 300 pages. In the time contraints I had (a month) I couldn't afford to deal with Lippman's C++ Primer or Stroustrup bible (both reknowned books, but over 900 pages). You don't even need to finish Accelerated C++ to start coding in C++. <a href="http://www.acceleratedcpp.com/" rel="nofollow">http://www.acceleratedcpp.com/</a><p>For STL, I recommend Josuttis's "The C++ Standard Library". It's a STL reference book, very complete and easy to browse. There are also brief examples on own to use the classes and templates. <a href="http://www.josuttis.com/libbook/" rel="nofollow">http://www.josuttis.com/libbook/</a>
allenbrunsonabout 17 years ago
i see a lot of people bashing c++ here, and rightly so, i guess. its evolution was too heavily influenced by backward compatibility and pleasing too many masters, in my opinion. i still like to program with it anyway, because i use my own restricted subset.<p>if you're in a hurry, maybe you should learn just plain old C, which is a lot simpler, and then sort of quickly rush through classes and other stuff specific to C++.<p>i'm kind of in the same boat. i'm teaching myself ruby, so i can eventually become an RoR programmer, and join all you hacker news types in the web 2.0 world. before that, i taught myself objective-c, so i could do cocoa programming on the mac. there's some surprising similarities between ruby and obj-c that i wasn't expecting.
Erfabout 17 years ago
I recommend Herb Sutter's classic Guru of the Week articles: <a href="http://www.gotw.ca/gotw/" rel="nofollow">http://www.gotw.ca/gotw/</a> There's a lot of usually-uselss arcane stuff in there, but also a lot of valuable information.
评论 #165188 未加载
brentrabout 17 years ago
I suggest Deitel's C++: How to Program as a good introduction to the language. If you read a chapter a night and do several of the exercises, you could get through the book in under a month.<p>Personally, I think C++ is a great language. Many people don't think as highly as I do of it, instead preferring some of the more dynamic typing languages, but you have a lot of power at your disposal once you manage to wrap your head around it.<p>I got started with C++ because I come from a financial background, and most financial apps in the real world are written using C++.<p>Why do you have to learn the language within a month?
评论 #165496 未加载
tptacekabout 17 years ago
Effective STL Programming by Meyers is probably your best bet for comprehension and fluency.<p>Stroustrop is surprisingly good as a walkthrough of the language itself.<p>Modern C++ Design by Alexander Alexendrescu is the best advanced book.
baboabout 17 years ago
C++ FAQ is like an instant cafe for the language, give it a shot! <a href="http://www.parashift.com/c++-faq-lite/" rel="nofollow">http://www.parashift.com/c++-faq-lite/</a>
ilitiritabout 17 years ago
I love C++<p>There are so many crooks and nannies, pitfalls and gotchas in the language that most people either give up, or they take the time to learn to do things the "right" way. I fall into the latter group.<p>However, I absolutely <i>despise</i> the C/C++ compile/link model. And I hate STL errors, or any sort of error that arise from the incorrect use of templates. And header files need to die.<p>I learnt most of the C++ I know from tutorials on the Web.
thedbradleyabout 17 years ago
If you're a fluent Pythonista then I say just dive right in. You could spend a month learning syntax and STL stuff, but a good programmer can pick up a language as they go. See something you don't get? Google-it. You'll be banging out code in no time.<p>Oh, and a Safari account will go a long way to help you quickly find relevant GOOD material (not just script-kiddie posts).
jsrnabout 17 years ago
&#62; I am looking for suggestions for good books for C, C++, STL and Symbian.<p>Accelerated C++ by Andrew Koenig and Barbara E. Moo is a very good book on C++, IMO. It's concise, it doesn't teach you everything but the 80% you will need most of the time and it introduces the STL right from the beginning.
评论 #165353 未加载
gcvabout 17 years ago
Although it hardly counts as introductory material, I really like a book called Expect C Programming, by Peter van der Linden. The author worked on Sun's C compiler, and has a lot of valuable insights into C. Basically, the book consists of a large list of "these are the things about C which will bite you." For example (please don't just Google for the answer): when is an array in C not equivalent to a pointer?<p>The book contains a chapter on C++; plenty for a C programmer to get started. Unlike sources like the C++ FAQ, I don't believe it makes sense to treat C++ as a language separate from C, and I don't think a C++ programmer without a gut understanding of the semantics of C is a good C++ programmer.
JFredabout 17 years ago
I don't think you can become a proficient C++ coder in one month unless you're really, really smart and unusual. Maybe not even then.<p>Although, it depends on what you mean by "Hack basic apps", doesn't it?<p>If you're working on existing apps then you'll need to know the same subset of the language that the original programmers knew. If you're going to write apps from scratch you might do very well by starting only with the Symbian programmers documentation, if it's good. Beyond that, just learn C and use C++ as a "Better C".<p>If you can avoid using classes and templates you can start quicker.
st3fanabout 17 years ago
"""PS: What do you think of C++ as a language?"""<p>I love to write UNIX tools and network servers in C++. But for projects that don't need the raw speed I simply use Python or Java. You will be 10x more productive in those languages.<p>One more thing: C++ becomes really nice when you add the right libraries to it. The STL is extremely limited but now with Boost 1.35 things get really interesting.<p>Check out <a href="http://www.boost.org" rel="nofollow">http://www.boost.org</a> if you are serious about C++.<p>(Won't help much on Symbian I think, but that platform is terrrrrible anyway.)
jfarmerabout 17 years ago
Don't read a book, write code. There are lots of open source projects that use C++, maybe try to get involved.<p>Or just give yourself challenges. Rewrite some non-trivial code you did in Python to use C++, for example, and ask experienced C++ people to comment.<p>Also, as others have said, use Boost and STL if you value your sanity.<p>In practical terms, I'd rather use C+Python or C+Ruby than C++. I template in a high-level language and move the stuff in tight loops or otherwise performance-critical sections into C.
elfredabout 17 years ago
I'd also recommend The C++ Standard Library: A Tutorial and Reference <a href="http://www.amazon.com/s/ref=nb_ss_gw?url=search-alias%3Daps&#38;field-keywords=standard+template+library&#38;x=0&#38;y=0" rel="nofollow">http://www.amazon.com/s/ref=nb_ss_gw?url=search-alias%3Daps&...</a> for STL usage.
andrewfabout 17 years ago
Josuttis' "The C++ Standard Library" is the most heavily thumbed through C++ book at work.
jgrahamcabout 17 years ago
C++ is on my list of 'languages I was forced to learn but would not have chosen to'<p>1. Languages I chose to learn: BASIC, Assembly Language, C, LISP, Perl, Javascript, Ruby<p>2. Languages I was forced to learn: C++, Modula-2<p>3. Languages I have actively avoided: Tcl, Java
评论 #165391 未加载
noodleabout 17 years ago
i hate c++. i think i hate it because i was raised as a computer engineer on c, and the only substantial c++ i've really done is visual with MFC/wxwidgets/activex/opengl, which are all bitches to work with, imo.<p>as for books, i suggest these two: "the c++ programming language" by stroustrup; and "effective c++" by meyers
评论 #165151 未加载
samratjpabout 17 years ago
on the flip side, I have a question for kashif, any recommendations for learning Python really really fast?
评论 #165494 未加载
评论 #165536 未加载
palishabout 17 years ago
If you would like to do something significant within a months' time, learning C++ by reading a book is the worst possible course of action.<p>Start by following along with some basic C++ tutorials. Once you're comfy enough, start implementing your own small applications. (Write a program to accept a sentence from the user and print it out. Then write a function that takes two strings and returns true if the two strings are anagrams. Keep thinking up small apps.)<p>It is my opinion that you must avoid learning STL and Boost if you want to be productive within a month. Both libraries have enough quirks that it takes a significant amount of time and experience to use them correctly. For example, you don't need the std::vector or std::list containers. Simply allocate a sufficiently large array to hold your items, then allocate a larger array when the first one fills up. A std::map container (a dictionary) is also not needed if you're tracking a small number of items. Simply loop through all items until you find the one you're looking for.<p>Basically, start actually writing code as quickly as possible. If you feel like you're burning too much time trying to understand one tutorial, move on to another one. But make sure at the end of each day that you can look back and say, "I wrote a lot of apps today and I feel like I learned a lot."<p>Most importantly, don't be afraid to throw your old code away once you have a better understanding of how best to solve the problem. Implementing components as quickly as possible is the key to productivity. Rewriting your old code is the key to not making a mess.<p>Contact me at palish@gmail.com if you have any questions along the way. I'd be happy to help. I'm a self-taught graphics programmer, so I can relate to how scary C++ can seem at first. Try to implement each application in the simplest possible way.
评论 #165463 未加载
评论 #165552 未加载
评论 #165504 未加载
评论 #165530 未加载
评论 #165386 未加载