Let's focus in the 2% agreementBo Persson wrote:I disagree about 98%!michiguel wrote:I agree 100%.Zach Wegner wrote:I think C would be easier for a beginner to learn. No need to learn about namespaces, inheritance, operator overloading, polymorphism, etc. C++ has some nice features, but they won't really be useful until you know a lot about programming (and it would be bad to try and use them before then). It's a classic beginner's mistake to hear about the wonders of object oriented programming and then make every thing an object. This is inevitably slow. IMO you should learn C first and then decide if you want to learn C++.
Also, in my highly subjective opinion, C is a much more elegant language, since it matches in my mind what the CPU is doing. For every piece of code I write, I more or less know what the assembly is going to look like. When you see C++, you start have to dealing with function tables, templates, etc. It gets messy.

Second editions is actually very late 80's (almost by the time the 89 standard was published). Anyway, it is a classic that beat the test of time.That's the 1970's!michiguel wrote: Sherif, I was in your same situation and I have a strong opinion on this ==> Buy the classic "The C programming language" by Kernighan and Ritchie and learn it. It is a short book and if you are a skillful learner, your will be programming in C in no time. Of course, you have to like programming.
Thanks, I may go to the library and see whether I can read something interesting and learn. I mean it. However, I wonder the suitability of this book for a beginner in this hobby. That type of beginner is not the same as a comp. sci. first year college student. Just peeking at the sample pages available in that website I see the typical examples of a display model, oriented to teach OOP. IMHO, that is exactly what a beginner should be avoiding. Paticularly, if the goal is to write later a chess engine.If you want a new book about programming, aimed at beginners, try this:
http://www.research.att.com/~bs/programming.html
I would agree that C++ will be better than C if there is a book that teaches it as an "improved C", with better type checking, libraries, and that's it. Is there any? I believe that most of the whistles and bells will be distracting for a hobbyst, at least at the beginning. That was my point.
You don't need anything of that to write a chess engine. The only thing I use from above is malloc in a couple of places, and that is wrapped in another function.Learn C++ first, and you will realize that you will never need to learn the ugly and very dark corners of the C standard library, with functions like strcpy, malloc, memset, or others with easy to learn names like strpbrk, strxfrm, wcsncpy, and sscanf.michiguel wrote: For a chess engine you do not need C++. IMHO, for people like you or me, C++ is the worst decision possible. If you like to go higher level for other reasons, then learn Python. If you are going to make a living out of programming, maybe C++ is for you.
I think it is more important to buy a good book on data structures, than learn specifics of a complex language as C++. Keep the language simple, and go deep into structures and algorithms. Besides, I believe this is more fun.
When I started programming, I started with Turbo Pascal (~80's). Later, I learned the Object oriented features of new versions (early 90's). It was cool to learn, but implied an effort that was not needed. I just did it as a hobby.
Learn C first, and then you will realize that you will never need C++You may like to learn it as a hobby, though (as I may like to do it some day).
There are large parts of the C runtime that you hardly ever use in a C++ program. Why start out trying to learn that?
Very few C++ programmers find it easier to have functions like abs, labs, cabs, and fabs for the absolute value of different types, when std::abs works for all of them.
Miguel
Of course, this is my not so humble opinion from a professional programmer.michiguel wrote: Of course, this is my very humble opinion from a non-professional programmer.
Miguel