You are not logged in.
Pages: 1
Hi, I'm enrolled in a programming course, intro level C++. However, to learn to write good code you have to read good code.
Soo I wonder if anyone had any tip on a good C++ program one could study?
Sebastian A. Liem
Offline
Well, that's a tad subjective of course, but over all, you make a good point.
Two books I have are Kernighan & Richie's The C Programming Language and Stroustrup's The C++ Programming Language. The latter is more of a C++ reference book, but does contain lots of example usage, written by the creator of C++, so I find it adequate.
The former book, whilst dealing with C, is a classic and should be in your bookshelf.
Offline
Read code written by phrakture. I'm not sure what projects he's contributed to, but I'm sure its good code.
Dusty
Offline
Oh, I forgot about Andrew S. Tanenbaum - most code he writes and puts in his books seem to be rather lucid for C code. I'm sure his Minix OS is full of exemplary code.
Offline
Two books I have are Kernighan & Richie's The C Programming Language and Stroustrup's The C++ Programming Language. The latter is more of a C++ reference book, but does contain lots of example usage, written by the creator of C++, so I find it adequate.
K&R is, as arooaroo says, a classic. But then again, so is Casablanca, and no one watches that anymore 8). It's worth a read, but don't try following it too closely.
A few smaller C++ books which are well worth the read, besides Stroustup's "The C++ Programming Language (3rd ed)", are "Accelerated C++" (Koenig and Moo), "Modern C++ Design" (Alexandrescu), "Exceptional C++" (Sutter), and "The C++ Standard Library" (Josuttis).
Generally, don't read any "Teach yourself..." or "... in (24 hours|10 days)" type books. If you want a decent online book, Bruce Eckel's is ok (but not the best): http://www.mindview.net/Books/TICPP/Thi … CPP2e.html
Also, the "C++ FAQ Lite" is always a good reference: http://www.parashift.com/c++-faq-lite/
As for programs to study - boost.org has a set of libraries which are _great_. There's a problem though. The external interfaces to these libraries are awesome, but the implementations are made to work on every compiler under the sun, so it's a mess of defines and odd work-arounds in some places (boost::enable_shared_from_this anyone?). The original wmi window manager had pretty good C++ code, except for the fact that the guy obviously never heard of references.... I haven't looked at it in some time, but the urxvt code was fairly good last I checked.
Offline
Two books I have are Kernighan & Richie's The C Programming Language and Stroustrup's The C++ Programming Language. The latter is more of a C++ reference book, but does contain lots of example usage, written by the creator of C++, so I find it adequate.
I second both these recommendations, they're both invaluable resources. My university bookstore had a neat bundle deal on both of these (why are CS books usually so pricey ?), so you could try the same.
-nogoma
---
Code Happy, Code Ruby!
http://www.last.fm/user/nogoma/
Offline
(why are CS books usually so pricey ?)
Because only a handful of nerds actually buy them and they cost a bundle to produce. (Now that I work in publishing, I understand the pricing better. Although, now that I work for Pearson, I get most books discounted, including the aforementioned books as Pearson owns both Addison Wesley and Prentice Hall! Woo hoo!)
Offline
(why are CS books usually so pricey ?)
Cos uni students need them, and it's fun to make us poor students even more in debt...
I recommend the tutorial www.cplusplus.com, gives you the gist of the language basics, and it's more than enough to get you started. It isn't extensive, but it's a good starting point, and it's free.
Desktop: AMD Athlon64 3800+ Venice Core, 2GB PC3200, 2x160GB Maxtor DiamondMax 10, 2x320GB WD Caviar RE, Nvidia 6600GT 256MB
Laptop: Intel Pentium M, 512MB PC2700, 60GB IBM TravelStar, Nvidia 5200Go 64MB
Offline
K&R is, as arooaroo says, a classic. But then again, so is Casablanca, and no one watches that anymore 8).
Ha! One of my favourite movies. But yeah I know which books to get, it's only a matter of money. Altrough Modern C++ Design was new to me. I'll try to get my hands on K&R and Stroustrup's The C++ Programming Language ASAP.
If you want a decent online book, Bruce Eckel's is ok (but not the best): http://www.mindview.net/Books/TICPP/Thi … CPP2e.html
Thanks, I'll take a look at it.
Also, the "C++ FAQ Lite" is always a good reference: http://www.parashift.com/c++-faq-lite/
Yep, I read pieces out of it now and then.
The original wmi window manager had pretty good C++ code, except for the fact that the guy obviously never heard of references.... I haven't looked at it in some time, but the urxvt code was fairly good last I checked.
wmi and urxvt, I'll take a look at that.
Oh, I forgot about Andrew S. Tanenbaum - most code he writes and puts in his books seem to be rather lucid for C code. I'm sure his Minix OS is full of exemplary code.
Thanks for the tip, but I'm unsure if studying a OS as first app to be wise.
Sebastian A. Liem
Offline
Pages: 1