EvilZone
Programming and Scripting => C - C++ => : Xedafen September 16, 2014, 02:33:59 PM
-
I guess its time to ask the question. Which book is best for learning c++? Particularly in the game development department. I am new to programming as-well, so an introduction would be good. I was thinking about getting these books, or have any suggestions?
http://www.barnesandnoble.com/w/learn-c-for-game-development-bruce-sutherland/1117891106?ean=9781430264576 (http://www.barnesandnoble.com/w/learn-c-for-game-development-bruce-sutherland/1117891106?ean=9781430264576)
http://www.barnesandnoble.com/w/beginning-c-through-game-programming-michael-dawson/1118064334?ean=9781305109919 (http://www.barnesandnoble.com/w/beginning-c-through-game-programming-michael-dawson/1118064334?ean=9781305109919)
http://www.barnesandnoble.com/w/c-primer-stanley-b-lippman/1101580746?ean=9780321714114 (http://www.barnesandnoble.com/w/c-primer-stanley-b-lippman/1101580746?ean=9780321714114)
http://www.barnesandnoble.com/w/opengl-game-programming-kevin-hawkins/1100970048?ean=9780761533306
-
Hi there,
I'm glad you have decided to pick up programming, yet sad to see no one has replied yet. When I have time later in the day I will update this post with my recommendations and advice so hang in tight.
In the meanwhile if you are completely new to programming this is not a bad start: http://www.tutorialspoint.com/cprogramming/.
-
I liked http://www.learncpp.com/ myself. It's good when you need a quick c++ primer:)
-
I liked http://www.learncpp.com/ myself. It's good when you need a quick c++ primer:)
Actually I second that. It does not matter a whole lot if you start out in C or in C++ although in game development you are more likely to jump straight into C++. As far as buying the book goes I would follow Factionwars tutrorial link first. Having an understanding of C++ in general will also help you understand which book is more likely to be of use to you.
I would also like to add websites with C++ references:
http://www.cplusplus.com/reference/
http://en.cppreference.com/w/
-
Don't know if these might enlighten you. Take you pick: http://evilzone.org/c-c/c-guides-and-resources/ (http://evilzone.org/c-c/c-guides-and-resources/)
-
Actually I second that. It does not matter a whole lot if you start out in C or in C++
This might have been correct 10 years ago, but now C++ has completely different style to C. You can code in C if you use C++, but you cannot code in C++ if you use C. C++ is just different paradigm of thinking with classes (and everything that goes with that), objects, STL (if you don't use STL you are not programming in C++), etc
As one person on the Internet said:
"Put simply, what is considered idiomatic in C is definitely not idiomatic in C++.
C and C++ are very different languages in practice, because of the way people use them. C aims at minimalism, where C++ is a very complex language, with a lot of features."
-
This might have been correct 10 years ago, but now C++ has completely different style to C. You can code in C if you use C++, but you cannot code in C++ if you use C. C++ is just different paradigm of thinking with classes (and everything that goes with that), objects, STL (if you don't use STL you are not programming in C++), etc
As one person on the Internet said:
"Put simply, what is considered idiomatic in C is definitely not idiomatic in C++.
C and C++ are very different languages in practice, because of the way people use them. C aims at minimalism, where C++ is a very complex language, with a lot of features."
Hi s3my0n,
Although you are absolutely correct in in what you said I'm afraid you misinterpreted what I meant. Taking in consideration that the OP has no programming experience the first programs are going to be very minimalistic and simple in nature. Does it really matter then if you use C or C++ when you at highest write a function or two to learn the basics?
There is an argument to be made for C++'s STL and that the books mentioned by him all use C++ as a basis, but for the purpose of learning C/C++ I really don't think it matters a whole lot how you start out because it will be in roughly the same way and you'll still end up using the rich C++ environment in the end.
-
@Killordie; lets not make this another C/C++ battle. The current C++ way is very different from the C syntax. It even got worse with C++11 that took C++ in another very different galaxy.
At this point if you start with C, you are gonna start again from the beginning if you ever think of doing C++; forget almost every thing and relearn new approaches to your problem, OOp approaches with a huge mix of STL.
-
This might have been correct 10 years ago, but now C++ has completely different style to C. You can code in C if you use C++, but you cannot code in C++ if you use C. C++ is just different paradigm of thinking with classes (and everything that goes with that), objects, STL (if you don't use STL you are not programming in C++), etc
As one person on the Internet said:
"Put simply, what is considered idiomatic in C is definitely not idiomatic in C++.
C and C++ are very different languages in practice, because of the way people use them. C aims at minimalism, where C++ is a very complex language, with a lot of features."
Actually, this is only semi-true... If you attempt to write C++, coming from a C background, you'll probably end up just using pointers where references and/or iterators would be better suited paired with some kind of container. You may be frustrated by things like sizeof('x') in C vs. sizeof('x') in C++, but those are still quite minimal issues. If you use a function in C++ like malloc() and you're used to not casting the return, a compiler error should guide you in the right path pretty quickly. Just because the standard idea of C++ typically requires a different way of thinking, doesn't mean you can't write C-like code in C++. You probably just won't be using half of the features available to the language is all.
So I assume you mean to say that "you can't write REAL C++ code coming from a C background," just to clear the confusion, and if that's the case, then you are 100% correct.
Because it's bad to mix the two... If you use C I/O instead of C++ I/O when programming in C++, you're probably not taking advantage of RAII as you should for instance with things like std::?fstream.
There was a comparison I read recently.
"Using C is like walking on one side of the road and possibly getting hit by cars in one direction, using C++ is like walking on the other side of the road and getting hit by cars going in the opposite direction, but using C & C++ is like walking down the middle of the road and getting hit by cars going in both directions."
Hi s3my0n,
Although you are absolutely correct in in what you said I'm afraid you misinterpreted what I meant. Taking in consideration that the OP has no programming experience the first programs are going to be very minimalistic and simple in nature. Does it really matter then if you use C or C++ when you at highest write a function or two to learn the basics?
There is an argument to be made for C++'s STL and that the books mentioned by him all use C++ as a basis, but for the purpose of learning C/C++ I really don't think it matters a whole lot how you start out because it will be in roughly the same way and you'll still end up using the rich C++ environment in the end.
Maybe it doesn't matter, but as I said, you can still run into discrepancies without delving into the STL for the comparison of C and C++. These languages are even less comparable now as the years go by... If you happen to run into one of the small but subtle differences, it may be confusing to the person trying to learn the language.
If you have an idea of what kinds of things you want to do with C/C++, then you should try to choose THE language of the two that best suits your goals, and stick with it. If at a later time you decide you want to learn the other, then do so... There are cases where C++ is more suitable than C and others where C is a better option than C++.
If you plan on learning C++ then, as s3my0n is trying to explain to you... You should NOT be trying to write C-like code in C++, just because it compiles fine. The STL is provided for a reason, and a good one at that. You don't have the STL in C, so if you're learning C++ or not, you're either using it or not using it; C or C++.
Killordie, there's a big difference between even the hello world versions of C and C++; printf() and std::cout are not even remotely the same, just because they can be used to write output to the console's stdout.