A C++ tutorial I wanted to point out to everyone.
I came across this free C++ book (C++ and QT) that is apparently very good. I'm reading it right now. If you want to learn about C++ and QT at the same time (and going by the looks of it and the table of contents, a lot about both), this book is great:
http://cartan.cas.suffolk.edu/oopdocbook/opensource/ |
It introduces QT and C++, but it focuses on design pattern in my opinion.
It's a nice resource :) Thanks! I have bookmarked it for reference. |
Thanks for posting, this looks like quite a nice resource.
|
Thanks, I find it useful. Is there a way a have an offline copy of the doc (that doesn't directly fetch the pages; packaged)? ;.. permissions?
|
Quote:
http://www.informit.com/store/produc...sbn=0131879057 The bound version is available at most bookstores. |
Quote:
|
As far as I can see, it misses two important aspects of C++ that are different from many other OOP languages and that you really should know about in order to write GOOD C++ code.
First, the paradigm "Resource Acquisition Is Initialization". It's important to do as much as possible in the member initialization list of a C++ constructor. You can read more about it here: http://www.devx.com/getHelpOn/10Minu...ion/17298/1954 http://en.wikipedia.org/wiki/Resourc...Initialization The other important issue is to properly understand why and when exactly destructors need to be declared "virtual": http://blogs.msdn.com/b/oldnewthing/...07/127826.aspx |
@zirias Well for me it's ok. I don't really follow standards or common philosophies on how C++ should be coded. I always use C++ to its fullest capability. I actually decide on how features of C++ should be used with a balance between speed or efficiency, and readability or design.
|
konsolebox:
1.) if you DON'T understand the initialization concept of C++, you WILL run in unnecessary problems, for example with the creation of objects on the stack or with static initialization, and you start to code "workarounds" that aren't really needed and are inefficient. 2.) if you fail to provide a virtual destructor where it's needed, you risk memory leaks and similar bugs. if you provide one where it is not needed, you introduce inefficiency through an unneeded vtable. So, I think it is very important to mention these things in any work trying to teach C++, at least in a later "advanced" chapter. |
Quote:
Quote:
Quote:
Edit: I'm not implying that I don't use virtuals. In fact I even use them often. The only thing is that whatever it is that discussed in the tutorial, common philosophies of C++ for me won't matter to it. And I think I have enough common sense for the things I need to use and the risks if I don't use them so I don't think I really have to follow standards. |
Quote:
Of course, you don't really HAVE to understand the concept of coupling resource allocation to initialization that lead to this syntactical construct; it's probably enough to know that it's best to use it as much as possible -- but still you should (somehow) know about it in order to be a good C++ programmer. Quote:
Quote:
And if you're so sure you won't fall for these not-so-uncommon problems, it's ok, I still think a thread where a specific tutorial is recommended to anyone wanting to learn the language is a quite good place to give additional tips missing from the tutorial. I didn't say anything about all the topics actually covered in the tut, they're probably quite good. |
Quote:
http://www2.research.att.com/~bs/bs_...l#virtual-dtor |
Quote:
|
I've postponed reading that tutorial, actually. :(
I've decided to start with the official Qt book, found here: http://www.qtrac.eu/C++-GUI-Programm...t-4-1st-ed.zip The other tutorial is good, but this is more of what I've personally been looking for. |
All times are GMT -5. The time now is 05:43 AM. |