Advice on whether a C++ book is still adequate
Hi,
I have the dusty book "Teach Yourself C++ 4th Ed" by Al Stevens, from... 1995 and wonder that if I go thru it will I screw myself up because of new language features. Thanks, Ron -- I prefer banana-flavored energy bars made from tofu. -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: 4D706E9F.9050606@cox.net">http://lists.debian.org/4D706E9F.9050606@cox.net |
Advice on whether a C++ book is still adequate
In <4D706E9F.9050606@cox.net>, Ron Johnson wrote:
>I have the dusty book "Teach Yourself C++ 4th Ed" by Al Stevens, >from... 1995 and wonder that if I go thru it will I screw myself up >because of new language features. I would ignore C++0x for now. I'm not sure if it has been published yet, but many of the new features won't be available portably for a couple of years. Instead, focus on C++98 and C++03. Neither were available at the time that book was written, so I'd probably look for a more recent reference. Prior to C++98, there was no standard[1] for the C++ language. You might also be interested in the C99 specifications -- they are not directly related to C++, but C++ is built upon some C and C99 is must more well-specified than C89 (the basis of C++98). [1] Depending on what you consider a standard. -- Boyd Stephen Smith Jr. ,= ,-_-. =. bss@iguanasuicide.net ((_/)o o(\_)) ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-' http://iguanasuicide.net/ \_/ |
Advice on whether a C++ book is still adequate
On Thu, Mar 3, 2011 at 20:46, Ron Johnson <ron.l.johnson@cox.net> wrote:
> Hi, > > I have the dusty book "Teach Yourself C++ 4th Ed" by Al Stevens, from... > 1995 and wonder that if I go thru it will I screw myself up because of new > language features. I don't know much about C++, but I remember how much Mozilla said their C++ coding changed from the old stuff (~1999) to the newer. They said much of the old code was considered ok at the time, but was just awful now. There was some specific feature (exceptions maybe? not sure at all) that they had rolled themselves and they where doing a lot of work to switch to the newer, standardized way, as well as other general clean up. All in all what I take from it is that it isn't so much the features, but how they are used. I think C++ just wasn't a really mature language till the early 2000s Cheers, Kelly Clowers -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: AANLkTindF9XvO=tbih5T7rO4W5XwCnHPoDQrNn-ziqiK@mail.gmail.com">http://lists.debian.org/AANLkTindF9XvO=tbih5T7rO4W5XwCnHPoDQrNn-ziqiK@mail.gmail.com |
Advice on whether a C++ book is still adequate
On 3/4/2011 3:28 AM, Kelly Clowers wrote:
On Thu, Mar 3, 2011 at 20:46, Ron Johnson<ron.l.johnson@cox.net> wrote: Hi, I have the dusty book "Teach Yourself C++ 4th Ed" by Al Stevens, from... 1995 and wonder that if I go thru it will I screw myself up because of new language features. I don't know much about C++, but I remember how much Mozilla said their C++ coding changed from the old stuff (~1999) to the newer. They said much of the old code was considered ok at the time, but was just awful now. There was some specific feature (exceptions maybe? not sure at all) that they had rolled themselves and they where doing a lot of work to switch to the newer, standardized way, as well as other general clean up. All in all what I take from it is that it isn't so much the features, but how they are used. I think C++ just wasn't a really mature language till the early 2000s Cheers, Kelly Clowers All that may be true, but C++ was being used at least as early as 1990 to do real work where I was employed. I don't know the language, altho I sort of recognize it. I wonder what they changed. There seems to be a tendency among programmers (cf. Linux developers) to never leave well enough alone! I always thought they ruined Turbo Pascal between version 3 and 5. That may be why it has virtually disappeared. --doug -- Outside of a dog, a book is man's best friend. Inside of a dog, it's too dark to read. --G. Marx -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: 4D70A78C.1070008@optonline.net">http://lists.debian.org/4D70A78C.1070008@optonline.net |
Advice on whether a C++ book is still adequate
On Thu, Mar 03, 2011 at 10:46:23PM -0600, Ron Johnson wrote:
> I have the dusty book "Teach Yourself C++ 4th Ed" by Al Stevens, > from... 1995 and wonder that if I go thru it will I screw myself up > because of new language features. You will certainly find it confusing. Most, if not all, code examples will fail to compile, and you will be learning the wrong way to do things. C++ was not standardised (both language and standard library) until 1999. This book is pre-standardisation. The main issue you'll run into is that the headers were all renamed, and namespaces were introduced. For example: #include <iostream.h> int main () { cout << "Hello world" << endl; } is now #include <iostream> int main () { std::cout << "Hello world" << std::endl; } (You can use "using std::cout;" to remove the need to use std:: every time.) But these are the most superficial differences. You would be able to use the book and make those corrections as you go through. But you would miss out entirely on newer features, most of which you'll probably want to use (even if you don't realise this at the start): references, namespaces, templates are good examples. But this is just the beginning. The main power of C++ comes though its standard library, especially its containers and algorithms. And then there's Boost, which is like the standard library, but better, with the kitchen sink, and on steroids. And perhaps even more importantly, the features are just features; the most important things to learn are the design skills and idioms which will make your code both efficient and robust. I found this invaluable: http://www.parashift.com/c++-faq-lite/ In particular http://www.parashift.com/c++-faq-lite/how-to-learn-cpp.html has some useful recommended texts. Being a learning by example person, I found the "official" Stroustrup text dry and uninspiring, unreadable even. I've heard good things about Koenig and Moo's Accelerated C++. I used "Practical C++ Programming" (O'Reilly) which covers the ISO standard C++, but isn't that amazing, and "Teach yourself C++ for Linux in 21 days" (SAMS), which is old pre-Standard but comes with lots of examples. Both only cover the core language, not the standard library except superficially. I bought a copy of Josuttis' The C++ Standard Library, which is an excellent guide and reference, but it does require learning the language first. Also, for later: http://www.boost.org/ Debian got the latest version in unstable just this week. If you would like to see some examples of modern C++, you could take a look at schroot. "apt-get source schroot", or have a browse around here: http://git.debian.org/?p=buildd-tools/schroot.git;a=tree;f=sbuild; This makes use of - templated exceptions - templated containers (map, list, vector) - some inheritance (mainly containment and delegation) - TR1/Boost smartpointers (shared_ptr, weak_ptr) for automatic reference-counted memory management, and tuples - Boost.Regex regular expressions - Boost.Program_options options parsing - Boost.Iostreams file descriptor streams to mix streams with basic systems programming and file locking [standard iostreams don't allow you to create a stream from a file descriptor, let along to locking etc.] - Boost.Filesystem for convenient filesystem functions (creating paths recursively etc.) It also includes a whole bunch of other stuff such as splitting strings into lists of strings and vice-versa (like perl split and join). If there's one thing I'd recommend learning to use, it's std::tr1::shared_ptr (boost::shared_ptr) from C++03. This gives you completely automatic reference-counted memory management. Whereas in C or old-style C++, you would do foo *alloc = malloc(sizeof(foo)); foo *alloc = new foo(); with shared_ptr you do this: std::tr1::shared_ptr<foo> alloc(new foo()); The advantage is that the former two require a manual free() or delete. The shared_ptr will free the memory when its destructor is run (when it goes out of scope). This is much easier to get correct that manual management, and is exception-safe. This means that in practice, you'll never see a "raw" pointer in good C++. One of the key things C++ allows that isn't in most of the books are idioms such as RAII (resource acquisition is initialisation), of which smartpointers are one example. http://www.hackcraft.net/raii/ Regards, Roger -- .'`. Roger Leigh : :' : Debian GNU/Linux http://people.debian.org/~rleigh/ `. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/ `- GPG Public Key: 0x25BFB848 Please GPG sign your mail. |
Advice on whether a C++ book is still adequate
Hi,
What's the latest "official" "release"? C++02? C++03? Has Boost been "officialized"? What about C#? I know it's not directly related, but how do you figure fits the picture? -- Mars 2 Stay! http://xkcd.com/801/ /etc -- To UNSUBSCRIBE, email to debian-user-REQUEST@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org Archive: AANLkTimiRnY-_empdo1iCYoQYGutM6WmEYrWMBAu1tD1@mail.gmail.com">h ttp://lists.debian.org/AANLkTimiRnY-_empdo1iCYoQYGutM6WmEYrWMBAu1tD1@mail.gmail.com |
Advice on whether a C++ book is still adequate
On Fri, Mar 04, 2011 at 10:30:22AM +0000, Nuno Magalhães wrote:
> What's the latest "official" "release"? C++02? C++03? Currently C++03 (C++98 with TR1). C++0x is due out really soon; support for most of it is already in current and upcoming GCC releases if you add -std=c++0x. Converting my code to use some of the new features is on my todo list (auto types, ranged for-loops, typed enums to begin with). http://en.wikipedia.org/wiki/C++0x > Has Boost been > "officialized"? Parts of boost have been imported into the standard library: shared_ptr/weak_ptr tuple and more http://en.wikipedia.org/wiki/C++_Technical_Report_1 and to come in C++0x hash tables regex and a bunch of other stuff I guess Boost can be considered as a source of useful components, the best of which are adopted into the standard library. > What about C#? I know it's not directly related, but > how do you figure fits the picture? What about it? I've never used it, and as far as C++ is concerned I don't see how it's at all related. Regards, Roger -- .'`. Roger Leigh : :' : Debian GNU/Linux http://people.debian.org/~rleigh/ `. `' Printing on GNU/Linux? http://gutenprint.sourceforge.net/ `- GPG Public Key: 0x25BFB848 Please GPG sign your mail. |
Advice on whether a C++ book is still adequate
On 2011-03-04 04:30:22 Nuno Magalhães wrote:
>What's the latest "official" "release"? ISO/IEC 14882:2003 Programming Languages -- C++ >C++02? C++03? It's not official, but the above specification is also called "C++03". It includes "TR1", which was library extensions on top of the first C++ standard. The first C++ standard was informally called "C++98". (The full name was ISO/IEC 14882:1998 Programming Languages -- C++.) >Has Boost been >"officialized"? Parts of boost were included in ISO/IEC 14882:2003, but they were moved to the "std" or "std::tr1" namespace. Like most ISO working groups, the C++ standard developers survey existing implementations to determine the what directions to take the language. However, the standardized version does not always match the behavior of your favorite implementation, even if that implementation was the originator/innovator. It is likely that a new revision of ISO/IEC 14882 comes out this year. Last time I checked, it had standardized a number of features based on the boost implementation. The also extended the language syntax in a number of ways. >What about C#? I know it's not directly related, but >how do you figure fits the picture? C# doesn't compete with C++, it competes with Java. Both C# and Java are good languages for a number of purposes. However, their object model (in particular, their inheritance model) is not as rich as C++, so there may complex systems where C++ saves the developers significant work. Managed C++ (a.k.a. C++/CLI) is more interesting. I'm not sure if MS is actively maintaining it; I know that initially it was a non-conforming variant of C++. I think the working group is actually interested in making it possible to compile standard C++ onto the CLI. That might let you use all the power of C++ from within .Net containers (Moonlight or mod_mono). -- Boyd Stephen Smith Jr. ,= ,-_-. =. bss@iguanasuicide.net ((_/)o o(\_)) ICQ: 514984 YM/AIM: DaTwinkDaddy `-'(. .)`-' http://iguanasuicide.net/ \_/ |
| All times are GMT. The time now is 11:13 AM. |
VBulletin, Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.