Fog Creek Software
Discussion Board




C++ reference sources

I'm consistently embarassed by my lack of expertise in this language.  Bah!

For example, I went looking for information on std::exception and came up with some useful links with definitions, but rarely any useful examples.  Got any?

For example: I access my classes storage out of range, I want to throw std::out_of_range which in inherits from std::exception from what I can tell.

Well anyway.  Looking for a good book with tutorials that take a person from intermediate level C++ usage to advanced, with _good_ non-trivial examples.  A trivial example would be using STL to hold int's.  Well, that's fine, but leaves out all the messyness of copy constructors, assignements, the intrisic problems C++ has (or I have with the language) with dealing with references (for example, there is no analog to NULL with references).

Thanks,

hoser
Tuesday, February 10, 2004

You can't beat books by Bjarne Stroustrup and Scott Meyers for getting from an intermediate level to a more advanced level with C++.  If you need a lot of handholding, they might not be for you (yet), but if you have programming experience and mostly know what you're doing, start there.

Michael Kale
Tuesday, February 10, 2004

I'm starting Thinking in C++ Vol. 2 by Bruce Eckel and it starts out with exceptions. I'm not sure if the examples are real enough for you, but you can download it for free to check it out.

http://mindview.net/Books/TICPP/ThinkingInCPP2e.html

sgf
Tuesday, February 10, 2004

If you need NULL, use pointers instead of references.

Frederik Slijkerman
Tuesday, February 10, 2004

I'll second the Scott Meyers books and add a plug for "The C++ Standard Library" by Josuttis.  I refer to that all the time.

Dobie
Tuesday, February 10, 2004

Scott Meyers is good.

Try also Herb Sutter's "Exceptional C++".

Subscribe to comp.lang.c++ and comp.lang.c++.moderated. In amongst all the anger there is useful information.

Use a pointer if you want null. (don't suggest "T &v=*static_cast<T *>(0)" -- that's nonsense.)

Insert half smiley here.
Tuesday, February 10, 2004

If you truly need a reference to an object that resembles NULL, the NullObject is a very nice pattern.

It's basically a dummy object that has the same interfaces as a real object, but does nothing.

See http://ch.twi.tudelft.nl/~mostert/striki/teststriki.pl?NullObject for details. Or google for it - there's plenty of references

Groby
Tuesday, February 10, 2004

Also "Large Scale C++ Software Design" by Lakos.

Andrew Lighten
Tuesday, February 10, 2004

C++ The complete reference 4th edition by Herbert Schildt

eddy
Tuesday, February 10, 2004

Ahh Herb Schildt ... many people's least favorite C++ author.

The 4th edition of that book appears to be an improvement, but personally I'd still be wary of anything written by Mr. Schildt, given how many bad reviews his other works have received.

http://accu.org/bookreviews/public/reviews/c/c002173.htm

(At the bottom of that page is a list of his other works and reviews by the ACCU.)

Michael Kale
Wednesday, February 11, 2004

My view of Herbert Schildt is that he writes the same thing over and over again. I bought one of his books, and it was good. His implementations were pretty simplistic, but he got the job done, and he explained the concepts quite well. Then I bought another one of his books, and it was essentially the same book. Later, I had occasion to flip through a few more of his books, which again turned out to be essentially the same book. So if you're not a competent C++ developer yet, Schildt may help you become one, but once you are one... don't bother.

I'm a fan of Jesse Liberty's books, myself. "Teach Yourself C++ in 21 Days" was surprisingly complete, and managed to demystify a couple things that were still somewhat nebulous in my head after being a C++ programmer for years. (It's easy to avoid certain behaviors by simply adhering to a coding standard that always does exactly what you expect.)

Caliban Tiresias Darklock
Wednesday, February 11, 2004

*  Recent Topics

*  Fog Creek Home