Archived

This topic is now archived and is closed to further replies.

It's ALL down hill with C++ from there! CRUD.

This topic is 5106 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok, maybe some of you can give me a bit of direction here. I'm working on a computer science major here, and since I am going for gaming, I am studying C++ by myself. I've bought over 5 quite good books on the matter, and am currently on just the basic C++ one. It's a Sams book of course which I consider to be good and bad at the same time. Teach yourself C++ in 24 hours, and it was quite good till chapter 8 and beyond :/ Then things went bad. After the basics, it attempted to show all sorts of uses for pointers, pointers to classes, copy constructors by use of pointers, references, more stuff that is poorly explained, and then more on top of that. Anyway, I'm almost completely lost, and only absorbed maybe half of it. The next book I'm looking at going towards is the Sams game programming book, however by looking at the book, and the fact it starts on windows API's, I really need to understand what on earth this C++ book is talking about half the time. It seems from the jump from this book to the next, this is quite a massive hurdle to get over. Not that anything like that would stop me, but it is slowing me down that is for sure :/ Maybe some of you have worked with this book (C++ in 24 hours) that I'm talking about? I'm taking an object oriented Java class for my major next semester, wondering if that will explain these concepts easier and what the heck they are even for as well, since C++ has some strong similarities to Java. So, what do you guys recomend? Anyone gone through this same problem with this book? Maybe you know a good site that runs through these concepts in a better explained way? Thanks for any help you might provide [edited by - Emonious on December 13, 2003 3:49:21 PM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Now this book is a very hard read, but one of my friend went through it without knowing anything about any programming languages and he came out with an amazing amount of knowledge for the time he had been reading it. It took him about five months to digest most of the book, but I was very impressed. You need a lot of self motivating though to go through this.

http://www-h.eng.cam.ac.uk/help/tpl/languages/C++/Thinking_in_C++/tic_c.html

As a side note, pointers is a pretty hard concept to first grasp on why it would be any useful, but try to understand how it works without worrying about why it is any useful. One day, it will hit you on the back of the head and everything will become more clear.

Also java won''t help you with the topics you just enumerated but you are right that there are a lot of similarities.

Good Luck.

Share this post


Link to post
Share on other sites
If you get confused with pointers, start with pointers in C.

If you get confused with classes, taking Java might help.

Before you can understand copy constructor, you need to understand pointers first.


Step by step and be patience.

Share this post


Link to post
Share on other sites
I agree with Ekim. When I first started learning about pointers I had no idea what they were talking about. Now I use them all the time, it just takes some practice to understand what is going on with them.

Also learning Java wont help you with pointers since the language hides those details from the programmer. So it should be easier since you never have to deal with pointers in Java.

Clippy:"OMG, A NUMBAR! Let me format it for you"
Unsuspecting Student: "Ahhhhh! Damn you paperclip you ruined my paper. A thousand deaths upon you!"

"Game Programming: Without programming you''ve just got game"

Share this post


Link to post
Share on other sites
I leared java before I learned c++, and it helped me a ton. Topics like classes, inheritance, member variables/methods are virtually identical in c++ and java.

As for pointers, practice makes perfect. Nobody really understands them at first, but as you use them more and more, you will get the hang of it.

As for the windows API, it would probably be best to gain a decent understanding of the c++ language before you jump into it. Programming the API will throw new topics at you like messages, window handles, and controls. After you get a handle on c++, I suggest picking up the book "Programming Windows" by Charles Petzold. That is the book I learned on, and It helped me a lot.

Share this post


Link to post
Share on other sites
I do understand the basics of pointers, (self taught myself C years back) however after the basics are repeated, it jumps straight into more advanced uses that are poorly explained, especially in PURPOSE.

Thanks for the input so far guys. I''m still trying

Share this post


Link to post
Share on other sites
C++ Primer Plus by Prata, published by Sams, the best C++ book ever, its my bible and everything is explained really well and in detail. Worth every little penny

- www.penten.tk -

Share this post


Link to post
Share on other sites
When I first started learning C++ i couldn''t think of a real purpose but now after havng started to use Java with it''s lack of pointers you really do realise just how invaluable they are. Don''t worrk if you don''t really understand their purpose for now - just get to grips with pointer syntax and arithmetic and once you are more experienced you will realise for yourself

My 2D game engine

Share this post


Link to post
Share on other sites
well I used "A First Book of C++. From here to There" by Gary J. Bronson...

I don''t even use it anymore, but I found it quite good when I was learning...

Your best bet is to just test it out... see what different things do. Every time you do something new... play around (can I do this, that, etc) with it and stop for a week and let your mind assimulate in the info and create it''s perception of it. Afterward you just know it... Although make sure you vagly understand something before you let your mind set it in stone... or you''ll get even more confussed... hehe...

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
Hello,
I wrote the final exam for first semester java just yesterday and I own both books you''re talking about. Although the java class won''t really help you understand pointers it''ll give you lots of help with classes. Also, the instructor should talk about memory storage and references in java so that might help with pointers but you''re probably best off doing what everyone else has said and just use them until you grasp them. Taking your time with the c++ book is a good idea, dont feel rushed. And DO NOT read the crap on linked lists until you''re really comfortable. That book really does goes go way too deep after the basics. As for the game programming book, if its the one I have which is the Game Programming with Direct X book, sorry but you wasted your bucks. I read through the whole thing and it''s pretty much just a walkthrough to make a basis 2d video game. There''s very little emphasis on helping you understand anything about Direct X. I might get slammed for saying this but try the GDS series Role Playing Game with Direct X book. It''s pricing and it''ll intimdate you at first but it''ll do you a lot more good than any SAMs crap. And don''t forget, if you wanna be a programmer, program. Figuring stuff out yourself or reading about how to do what YOU want to do is a lot more rewarding

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
I remember reading C for Dummies volume I and II as my first C programming books, and I remember it saying in them that pointers are something that are amazingly simple when you understand them but amazingly confusing when you''re trying to understand them, how true that was, pointers is a subject you need to read over and over from various sources until eventually you read an explanation where it just clicks and suddenly makes sense.

Another programming pitfall I''ve found is you learn far more by doing, playing around and reading up documentation when you get stuck than you do reading and reading and not giving yourself chance to actually do.

Programming is a massively broad subject, once you understand things like pointers it''s more beneficial to understand common algorithms and design patterns, such as how to write a linked list and such. The obvious problem here is that when you''ve been learning boring stuff the last thing you want is to learn more boring stuff, but you wont write quality software until you do unfortunately.

Share this post


Link to post
Share on other sites
I''ve never read the Sam''s book, but I learned C++ from ''C++ for Dummies'' way back when I was in grade 11. I found it to be a very good book, despite the name (and at that time there was no Sams), so I''d sugest giving that a try. Also if you''re having trouble with pointers get a C programming book (forget the whole ++ for a while) cause they usually do a better job of explaining them. Pointers in C++ are for the most part identical to pointers in C, until you get to things like member function pointers, dynamic casting, and other such advanced topics,which you shouldn''t be worrying about right now. And just like everyone else has been saying, just start using them, you''ll learn how to use em long before you''ll understand em.

Share this post


Link to post
Share on other sites
Pointers are use for day-to-day following purposes:

1)to obtain a handle to objects stored on the heap
2)to pass data in/out of functions efficiently
3)to point to another object or for building relationship

Say you had a list of objects. In the editor you make a selection and pick some objects. You can do either of two things. 1)go thru the list of objects and mark those that were picked or 2)create another list of pointers to those objects

Now, say you want to rotate the selection. In 1) it would be inefficient to walk the whole list of objects and checking which one is selected and which isn''t and in 2) it would be more efficient because you''re walking pointers to only the selected objects ignoring all the unselected objects. Data structures such as half-edge rely explicitly on pointers to form the complex relation between vertices, edges, half-edges, faces, etc.

I recommend that you concentrate on C first and foremost. Then you can decide whether OO is appropriate or not based on your app requirements.

Share this post


Link to post
Share on other sites
Heh I learned how to do pointers by gamehacking.. Anyhow about books.. Sams books really seem to have a bad rep.. The only good ones I''ve seen were the Primer Plus series, everyone seems to like O''reilly books and from what I''ve read, O''reilly ones go way more in depth than Sams ones do..

Share this post


Link to post
Share on other sites
quote:
Original post by anykey
Hi

I found this http://www.cplusplus.com/ place quite good for learning C++ and from memory it describes pointers quite well.


I actually have a bit more preference with cppreference.com or this site over cplusplus.com. Its still a good site, though not complete since just a few days ago I was looking for a reference on maps and there was nothing about it on there whereas the other two had it.

@Emonious: I started with Accelerated C++ and that book has really given me a good headstart with using STL. It takes some serious studying to absorb everything, but the book is authored by two well respected computer scientists from Bell labs (Koenig and Moo) so you can trust that they will present the material well IMHO.

Share this post


Link to post
Share on other sites
Cheers Nervo.

Will check them out.

I am reasonbly new to C++ but have a background in Basic (as far back as C64's) and Avenue, So I am still coming to grips with the extendability (???) of C++. It is good to have access to as much refrence material as possible.

.. The first is exactly what I have been looking for, cheers.

[edited by - anykey on December 14, 2003 1:28:26 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:
Original post by Nervo
quote:
Original post by anykey
Hi

I found this http://www.cplusplus.com/ place quite good for learning C++ and from memory it describes pointers quite well.


I actually have a bit more preference with <a href=http://www.cppreference.com>cppreference.com</a> or <a href=http://www.sgi.com/tech/stl/>this site</a> over cplusplus.com. Its still a good site, though not complete since just a few days ago I was looking for a reference on maps and there was nothing about it on there whereas the other two had it.

@Emonious: I started with Accelerated C++ and that book has really given me a good headstart with using STL. It takes some serious studying to absorb everything, but the book is authored by two well respected computer scientists from Bell labs (Koenig and Moo) so you can trust that they will present the material well IMHO.


When deciding which reference to use you really should make sure that its referencing your compilers implementation of the STL. I normally use cppreference.com, but a couple weeks ago I ended up spending an hour debugging a peice of code only to realize that cppreference.com wasn''t talking about the same implementation that I use. Normally this isnt a problem but unfortunately there are a few places where the implementations still vary

Share this post


Link to post
Share on other sites
Everyone has a different idea of what a good book is. I got C++ Primer Plus and thought it was terrible, then I returned it and got Object Oriented programming with C++ by Robert Lafore and that was better. My advice to you is go to your local Borders/Books-a-million, get the books that your interested in, scan them over for 20 days or so(keep the receipts), pick one you like, return them all and then order the one you like from Amazon, which is usually a lot cheaper.

Share this post


Link to post
Share on other sites
quote:
Original post by Ekim_Gram
Just practice with pointers now. Don''t try to understand them, you will in time.



R.I.P. Mark Osback
Solo Pa Mi Gente
VG-Force


very good recommedation that''s what I tell all of my friends. Plus the great thing is if you don''t get it, just give Visual Studio a try .NET has a really good implementation that will make everyday pointer use easier. Once you start picking up on what VS.NET is telling you, you can expand your knowledge. As long as you aren''t working with the STL and pointers the basic pointer stuffs VS.NET will explain for you while you code.

Share this post


Link to post
Share on other sites