ot c++ help

Submitted by b-diddy on
what im looking for is a good guide for C++. i have a background in c#, but have let 5 months of rust accumulate, and the company i work for (trying to bust into programming department) codes in c++. my understing is that the two are so similar that i could probably pick up c++ in a day or two, but since i could use a refresher i could really go in a lot of directions. it could be a book for novices, intermediates, or even advanceds. mostly, i want it to be quality (i've seen a lot of not too helpful stuff out there). i learned c# using headfirst (oreilly), and would use them again, but can anyone recommend something better? thanks in advance!

david from wyoming

February 16th, 2010 at 10:51 AM ^

01010111 01001000 01000001 01010100 00111111 00100000 01000010 01110010 01101001 01101110 01100111 00100000 01100010 01100001 01100011 01101011 00100000 01100010 01101001 01101110 01100001 01110010 01111001 00100000 01110100 01101000 01110010 01100101 01100001 01100100 01110011 00100001

spumich

February 16th, 2010 at 12:39 AM ^

http://www.cprogramming.com/ This site has some information and available books that may help you out. I took C++ back in 1999 and now I am in a completely different field, but "C++ Without Fear" is pretty good, or at least from what I remember. You can also find it for sale at the site I mentioned. If you just need to brush up you should try your local library. Then you can figure out what style works best for you. Good luck.

Muttley

February 16th, 2010 at 12:46 AM ^

Closer to the metal, C++ is faster (to run) than C# (but not faster to code). Unlike the managed c#, you have to write code to allocate memory for what would be reference types in C# and then deallocate them when you're done. I don't miss debugging memory leaks. Good luck! (I don't have any book suggestions. This is likely obvious, but here is the msdn c++ home http://msdn.microsoft.com/en-us/visualc/default.aspx )

jb5O4

February 16th, 2010 at 12:58 AM ^

Wow I bet even the Georgia Tech message boards don't make C++ posts. I've never programmed in C# before but C++ is probably similar. I'm assuming you guy are doing object oriented programming. Ill have to dig up som old sites I used in high school and Eng 101. What kinds of programs are yall writing?

TTUwolverine

February 16th, 2010 at 11:54 AM ^

But, I am a not a computer scientist, and rarely ever require the use of a base-level language like C to accomplish what I need. Although both programs were created for more user friendly scientific applications, this is a very apples and oranges comparison. FTR, I actually like Labview. It's a very unique approach to programming.

octal9

February 16th, 2010 at 1:16 AM ^

C# is a bit closer to java in actuality, I think. Syntactically you'll be mostly be ok, but there are some "gotcha"s in C/C++ that are really just bonkers (off the top of my head, pointers to member functions. templates can make for headaches too). As for references, eh. Most of the textbooks I had in school were rubbish. Definitely learn how to use pointers. edit: No, seriously. Learn how to use pointers. And other stuff.

Brian

February 16th, 2010 at 1:17 AM ^

it's been a while but IIRC that is accurate. C# is a hand-holding version of C++, and I don't mean that pejoratively. For the class of applications it's designed for it's a far superior option, and really just about everything these days should be in a memory-managed language. If you need performance improvements, then you get closer to the metal. Mostly you'll have to learn about a crap ton of memory leaks.

Not a Blue Fan

February 16th, 2010 at 6:36 AM ^

I've got about 3-4 years experience writing experimental control software in C#, C++, and (just a little) C. In case you're wondering, I design and construct experimental apparatus for a surgical device research company. In terms of speed, C# is not appreciably slower than C++ (for most applications). The fact that it compiles on demand means it can actually match C++ in terms of performance on a system-by-system basis, since the compiler effectively optimizes the code each time it is run. C++ can beat C# (and often does), but it usually requires hours upon hours of optimization (and really only makes sense for huge projects wherein speed in crucial). Anyway, I taught myself C++ and C# through web resources (mainly just googling) and by convincing an older co-worker to let me have copies of his source code from the past 10 years. Simply having properly written code that you can reference for syntactical tips is a huge plus. Since you're (presumably) already comfortable with the OO paradigm, make heavy use of it in the C++ environment and encapsulate like crazy. I found that making a huge library of custom classes that spanned across projects was helpful (not having to re-write code to detect and configure DAQs was a big time saver). At any rate, I can't think of any really useful books. For the most part (as I'm sure you're aware), learning a programming language is mostly about just doing it and learning as you go. That's what I would recommend doing: create simple projects with a pre-determined goal of learning perhaps 1 or 2 specific new skills. Also, learn to love pointers. You could very easily program many hundreds of thousands of lines of code in C# without touching pointers...not so much in C++. Especially if you ever need a dynamically scalable array (and big projects usually need something like this).

Not a Blue Fan

February 16th, 2010 at 9:27 AM ^

I'll bite; I got stuck building a DAQ system whose design document specified "no effective ceiling on modular sensor count". Oh joy. Basically, it was a command system that controlled and sampled data from a system of sensor arrays (the number of arrays being variable) with an undetermined number of sensors (that is, the number of sensors in each array varied in each array). In addition, I needed to have a sample buffer (of course, with variable depth) for each individual sensor on each individual array. That's a 3D array with unknown size along each axis (and the size may vary on a per-element basis). There was also an axis that contained configuration data (an axis who elements were classes regarding sensor configuration - calibration, etc). I couldn't find an STL based solution (not that my knowledge of the STL is that extensive), so I just wrote the memory manager myself as a single block of resizable (log2 resizing for the sake of efficiency) and a separate index detailing the size of each element (to allow for ease of element lookup). I'm far, far from the world's best coder. I do think that's a reasonable solution, though.

pontoon

February 16th, 2010 at 9:03 AM ^

I have a pdf copy of 'The C++ Programming Language' 3rd edition by Bjarne Stroustrup (creator of c++). I thought it was a good reference and was very detailed. I have it on my desktop, so I can email you a copy when I get home from work today if you're interested. [email protected] [edit: Most of the time I just use cplusplus.com though.]

jonny_GoBlue

February 16th, 2010 at 8:58 AM ^

Seriously... you'll reference this book a LOT while you're becoming comfortable with C++ and it's written by the father of the language, Bjarne Stroustrup. The C++ Programming Language: Special Edition (Hardcover) http://www.amazon.com/C-Programming-Language-Special/dp/0201700735/ref=… I can't speak to it's ability to teach you the language as I had already learned C++ before ever picking up this book, but I think it's a book that every C++ programmer should peruse at some point, regardless of how much they think they know.

Laveranues

February 16th, 2010 at 9:37 AM ^

This is the book I learned from: C++ Primer Plus (5th Edition) by Stephen Prata (~$30 on Amazon). It's the only one I ever read, so I can't speak to its relative quality, but it was very helpful to me (a noob). A lot is probably redundant if you already are conversant in c#, but I don't think there's any way around that.

a non emu

February 16th, 2010 at 1:59 PM ^

this book is waaay too basic for what he is looking for. That isn't even C++. For the most part that is just C. He doesn't even go into classes and objects, which makes sense since this is ENG 101. I do all my programming in C and assembly now, and haven't touched C++ in a while, but I remember using the Strastroupe book and remember it being good. It has a ton of information in it. You didn't mention if you'd used C before, in which case you will find a lot of things about the language works familiar. Again, others have said this, but learn to love and live pointers.. you will need to dereference the crap out of stuff soon enough :) EDIT - oh and the manual memory management (heap, stack stuff..), and garbage collection.

joeyb

February 16th, 2010 at 10:14 AM ^

Just so that you know, you will probably get frustrated with C++ coming from C#. You are going backward in that language's evolution and a lot of things that you take for granted in C# you will need to do yourself in C++. O'Reilly is usually the best, so I would suggest them.

Blazefire

February 16th, 2010 at 10:26 AM ^

I tell you people... I'm a Public Relations major. If I have to hear one more story from one of my computer engineer friends about how they failed a whole class of Freshman when they were a Senior T/A, because they hard coded the results of a scalable array into a program instead of actually learning and demonstrating it, my head will explode! Your new program is nothing, NOTHING without ME there to find the right people to deliver the message to, and to deliver it the right way. MUHAHAHA! /PR Major trying to make himself feel some worth.

david from wyoming

February 16th, 2010 at 10:48 AM ^

Well-well look. I already told you: I deal with the god damn customers so the engineers don't have to. I have people skills; I am good at dealing with people. Can't you understand that? What the hell is wrong with you people?