Learning c++ by yourself.

Started by
16 comments, last by Ectara 11 years, 4 months ago
As far as looking at existing code, there are a lot of example snippets on MSDN.

For example: http://msdn.microsoft.com/en-us/library/bb384843.aspx

That particular example is using the old C-style API for Win32, but you can get quite a lot of sample code by browsing different areas of MSDN.

You can also find a lot of free, open source projects, but I don't really recommend using those to learn since quite a lot of them have horrible coding practices or take a lot of effort before they will even compile.
Advertisement
Win32 API is not good c++. All sample code usually omit most of the error checking to keep it short. Samples are almost never good enough to be used as is. (If function returns an error code, then it should be checked, etc.)

For c++ network programming, maybe try setting up and playing with boost::asio
http://www.boost.org/doc/libs/1_52_0/doc/html/boost_asio/overview/networking/protocols.html

For general advanced c++ programming:
http://www.drdobbs.com/cpp
http://cpp-next.com/ (mostly about advanced c++11 stuff and future of c++)
http://www.parashift.com/c%2B%2B-faq-lite/
http://herbsutter.com/
http://scottmeyers.blogspot.com/
http://isocpp.org/blog/category/articles-books

And everything the authors of those blogs have written in past 10 years.

Microsoft seems to finally try invest in some decent c++ code:
Welcome Back to C++ (Modern C++)
http://msdn.microsoft.com/en-us/library/hh279654.aspx

Rather old, but still better than most guidelines. Really paved the modern c++ in for me 10 years ago. (important stuff starts from section 5 onwards, but there are some outdated advices. Also harder to google, year after year)
http://files.rsdn.ru/19450/coding_guidelines.html

[quote name='thornx1' timestamp='1354515514' post='5006508']
Now, books put me to sleep for some reason, i can read 12 hours strait on the computer but not in a book so please don't give me books to get it would take me weeks to read even a few hundred pages.


pro tip... buy books in PDF format and read them on your PC?

Get Stroustrup's book on C++, it's a very good book to read after you've covered your basics.
Also get a book on game programming in C++.

Tutorials are ok, but they are very specific to a task.. and once you lift off from basic "guess the number" stuff you'll need space, professionalism and dedication.. thus, you need a good book.
[/quote]

I believe the few beginners tutorials i have read have brought me through everything in the book and i have enough experience in the basics of it all.

Reading is good, but doing is better.

If you feel like you've absorbed enough to write a program - even a very, very trivial program - go write programs. Pick something that seems within your reach and do it. Then pick something else that's slightly beyond your reach and do that. Rinse, repeat.


Where could i get ideas on projects to complete in order to accomplish this? im not very good at thinking up things.

Effective C++: 55 Specific Ways to Improve Your Programs and Designs (3rd Edition) by Scott Meyers is a good intermediate text. You can get it for Kindle.
http://www.amazon.co...s/dp/0321334876

I'd have to say that the quality of discourse in published books is of a much higher caliber than that to be found in online tutorials. You can really bootstrap yourself into some good knowledge if you just take a few months to just read. In fact, that is what I am doing now. In just a few months I have gone from total noob at C++ to kinda knowing my way around, and starting to write some original programs, basic game demos, user interface code, etc.

The key is to just stick with it because you will probably want to quit, at least once weekly. Try to force yourself to program for some hours per day, also, and do all the exercises given in the book, but do them with zeal, adding features.

Best of luck.


I will look for a pdf file of some intermediate books if i cant find one for the one you suggested, thanks!

Win32 API is not good c++. All sample code usually omit most of the error checking to keep it short. Samples are almost never good enough to be used as is. (If function returns an error code, then it should be checked, etc.)

For c++ network programming, maybe try setting up and playing with boost::asio
http://www.boost.org.../protocols.html

For general advanced c++ programming:
http://www.drdobbs.com/cpp
http://cpp-next.com/ (mostly about advanced c++11 stuff and future of c++)
http://www.parashift...m/c++-faq-lite/
http://herbsutter.com/
http://scottmeyers.blogspot.com/
http://isocpp.org/bl.../articles-books

And everything the authors of those blogs have written in past 10 years.

Microsoft seems to finally try invest in some decent c++ code:
Welcome Back to C++ (Modern C++)
http://msdn.microsof...y/hh279654.aspx

Rather old, but still better than most guidelines. Really paved the modern c++ in for me 10 years ago. (important stuff starts from section 5 onwards, but there are some outdated advices. Also harder to google, year after year)
http://files.rsdn.ru...guidelines.html

Thank you for these! ill look into them all.
http://isocpp.org/get-started
http://herbsutter.com/2012/11/20/reader-qa-a-good-book-to-learn-c11/
http://www.parashift.com/c++-faq/buy-several-books.html

IMHO, it's much, much better to go through (as in "actually go through" -- not just read, but also do the programming exercises) one book like C++ Primer, 5th Edition by Stanley B. Lippman, Josée LaJoie, Barbara E. Moo than, say, go through 20 on-line tutorials (and probably faster, too) -- esp. since most (if not all) of these tutorials will cover the same 5% of the language. In fact, I'd strongly recommend to lay off tutorials at this point and do just that :-)

Also, as someone noticed, at some point it's a good idea to go through a coding style guide. You don't have to agree with 100% of the rules, but it's good to be able to make informed choices about them (which you won't be able to do if won't be aware of their existence). I recommend "POCO C++ Libraries Coding Style Guide" from here -- http://pocoproject.org/documentation/

// IMHO, they're much better and more widely applicable to general C++ coding than the ones from Google, but then again, Google's code base is extremely specific, so if you happen to work at Google and work on their code base there might be a good reason to use them in such a niche.

I believe the few beginners tutorials i have read have brought me through everything in the book and i have enough experience in the basics of it all.

Again, we cannot stress the experience. Doing tutorials only gives you experience in the topic of the tutorial. Tutorials rarely teach you error checking, as mentioned above. They rarely teach you how to make the best classes, "KISS" and "DRY" principles, or any good idea that has come through almost 15 years of the language.

For the most part, tutorials are quick hacks put together to achieve a purpose, posted on an unmoderated and unaccredited medium, so there is no standard of quality. A book, however, is much higher quality, and often has multiple authors, an editor, a review board, and a publishing house.

Put a step further, once you see a tutorial to show you what the language looks like, and its basic grammar, it's time to learn the rules. You need to learn from an authoritative book on C++ (not for Game Making or any express purpose, just the language), and finally learn _why_ the examples work. Then, learn _why_ everything else in the language. Tutorials are quick code samples made for showing you how. Books are made for teaching you why.

This topic is closed to new replies.

Advertisement