The Nightstar Zoo

Nightstar IRC Network - irc.nightstar.net
It is currently Fri Sep 22, 2017 3:40 pm

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
PostPosted: Sun Aug 07, 2005 9:03 pm 
Offline
Concession Worker
Concession Worker
User avatar

Joined: Tue Jul 01, 2003 5:26 pm
Posts: 1479
Location: R'lyeh
Two new threads in a single month! The end is nigh!


So... I am looking for good (and preferably free, although that isn't a strict requirement) resources for someone who already knows C but wants to learn C++. Most stuff I can find online either presumes that I have never programmed before in my entire life, or is well... just plain bad.

So I guess what I need is something that
1) Explains where and how C++'s intepretation of code differs from C's.
2) Explains OO from a C++ perspective (I have been at OOP before, I just don't think I can apply what little I know to C++).
3) Goes over all the new fun standard data types / functions / classes / whatevers.


Any suggestions?

_________________
Living in a state free from the burdens of privacy and democracy since 2008-06-18.


Top
 Profile  
 
PostPosted: Mon Aug 08, 2005 5:05 pm 
gnolam wrote:
3) Goes over all the new fun standard data types / functions / classes / whatevers.


Welcome to C++! There is no "standard" class library. You either have to use a 3rd party class library like MFC or QT or you have to fall back on C. They have the STL which is standard, which is is basically some data structures and a few other things, but that's it.

I recommend "The C++ Programming Language" by Stroustrup.


Top
  
 
 Post subject:
PostPosted: Mon Aug 08, 2005 9:18 pm 
Offline
Energizer Bunny
User avatar

Joined: Wed May 22, 2002 12:24 am
Posts: 1634
I recommend C++: How To Program by Dietel & Dietel.

That said, I do not think that it is appropriate to say you are 'transitioning' between C and C++. C and C++ share only the most basic of language constructs; each language requires a different mindset to program properly.

Vorn


Top
 Profile  
 
 Post subject:
PostPosted: Tue Aug 09, 2005 12:36 pm 
Vorn the Unspeakable wrote:
That said, I do not think that it is appropriate to say you are 'transitioning' between C and C++. C and C++ share only the most basic of language constructs; each language requires a different mindset to program properly.

Exactly. I was going to recommend learning C++ from scratch, even though you're not a beginner. Sure, you'll have to toil through some boring fundamentals, but I think you'll be better off in the end.

I've read a lot of bad code that stems from writing C++ as a C programmer... why do that when there are so many much more exciting reasons to write bad code? :)


Top
  
 
 Post subject:
PostPosted: Wed Aug 10, 2005 6:26 pm 
Offline
Nightstar Graveyard Daemon
User avatar

Joined: Mon Jun 03, 2002 8:30 pm
Posts: 1071
Location: Wouldn't you rather observe my Velocity?
There is a fantastic book, if somewhat dated, called Class Construction in C and C++ by Roger Sessions. It does exactly what you're looking for: assumes you understand C, and walks you through the concepts of C++. It hangs on bravely to C throughout the first half of the book, in fact, explaining that you can get many of the features of C++ like vtables, the "this" object, and information hiding, just by using some habits and protocols. Remember that for the first few years, C++ was a preprocessor that turned your code into C code. (Hence weird artifacts like name mangling.)

In the second half of the book, the author finally throws up his hands and says, "We can't go any farther in C. Time for C++, and here's why." Then he gives the new features (like inheritance) a pretty good treatment.

The book is quite dated (1992), but I found it a profoundly useful read. It's exactly the book you're looking for, I think. It's available at Amazon.com's used book store for $1.10. You'll pay more for shipping than for the book!

http://www.amazon.com/gp/product/offer- ... dition=all

Note that the book won't make you a master of C++. You'll need to go on and read another work, Deitel wouldn't be a bad choice, or perhaps jump forward in time and dive right into the STL. But the book gave me a more solid grasp of the mechanics of C++ than most college graduates.

I put the knowledge from that book solidly to work as recently as 2003, when I was programming in the Windows Kernel, which is a C-only environment. I recommend this book highly to anyone working in C++, even today.

...and knowing why "typedef struct struct Foo;" isn't a syntax error is just gravy.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Aug 11, 2005 6:47 pm 
Offline
Concession Worker
Concession Worker
User avatar

Joined: Tue Jul 01, 2003 5:26 pm
Posts: 1479
Location: R'lyeh
Spasibo bolshoi! Chalain's recommendation seems to fit my needs perfectly! Now I just have to decide if I want to get shafted on the book price (amazon.co.uk) or the shipping (amazon.com). ;)

Vorn the unspeakable wrote:
That said, I do not think that it is appropriate to say you are 'transitioning' between C and C++. C and C++ share only the most basic of language constructs; each language requires a different mindset to program properly.

Thus point 2 of the OP. :)
I have some sort-of-OO-ish stuff written in C... I just feel that C++ will probably make that a bit cleaner...
And the team project using C++ I'm in now might have had some influence as well. ;)

_________________
Living in a state free from the burdens of privacy and democracy since 2008-06-18.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Oct 20, 2005 5:23 pm 
Offline
Concession Worker
Concession Worker
User avatar

Joined: Tue Jul 01, 2003 5:26 pm
Posts: 1479
Location: R'lyeh
Followup:
The book just arrived. Horribly late and somewhat worse for wear, but hey - I can't really complain about the price. I'm fairly sure it cost 10 times what I paid for it when it was new. :)

Now I just have to see if it's any good. ;)

_________________
Living in a state free from the burdens of privacy and democracy since 2008-06-18.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 7 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group