Go Down

Topic: Best C++ Book? (Read 1 time) previous topic - next topic

5errated

I did a search but didn't find any useful threads.

So anyways, what are your recommendations for a good C++ book?  I haven't touched it much since high school (10 yrs ago) so I'm a bit rusty.  I've been able to get by for most of my arduino coding, but would like a beginner's book to read through to sharpen my coding skills in the C/C++ areas.

Any recommendations?

mkwired

Check out the following book.  It was written by the creator of the C++ language, but it doesn't mention Arduino but it does mentioned embedded programming.

http://www.amazon.com/Programming-Principles-Practice-Using-C/dp/0321543726

DVDdoug

#2
Jun 27, 2012, 01:52 am Last Edit: Jun 27, 2012, 02:07 am by DVDdoug Reason: 1
Everything I see with the Arduino is C (no object oriented programming).    I was thinking about using OOP on my next project, but I'm wondering if the limited RAM will be a problem, since objects need to be created (constructed) in RAM.

I started-out with Teach Yourself C in 21 Days, and Teach Yourself C++ in 21 Days.  Both of these were good beginning books.  (But, a lot of people seem to hate all of the 21-Days books.)  Accelerated C++ is a very-frequently recommended book, but I don't own it. 

I think the only other C book I have is The C Programming Language by Kernighan & Ritchie.    I believe it covers the complete (ANSI Standard) C language, so it serves as a complete reference.  (Of course it doesn't cover the special I/O functions, etc. for any particular embedded platform.)

I have a few more-advanced C++ books.  I'll just mention one -  Thinking In C++ is FREE online (legally).

As far as I know,the only complete C++ reference book is the ANSI/ISO Language Standard itself.  But as far as I can tell, the Arduino doesn't support the full C++ Standard Library (containers, etc.) anyway.  If these libraries exist, they are not mentioned in the Arduino Language Reference.   

P.S.
To me, it seems like the thing missing from most programming books is a good overview of what programming is, what it's all about, and what it's good-for, etc.    They just jump-in and start teaching you the language.   

This is a poor analogy, but it's a bit like teaching someone how write English without teaching how to be a journalist or author.


mkwired


Everything I see with the Arduino is C (no object oriented programming).    I was thinking about using OOP on my next project, but I'm wondering if the limited RAM will be a problem, since objects need to be created (constructed) in RAM.


Arduino uses a lot of the C++ features especially internally.  Most if not all of the libraries are C++ libraries.  You don't have to program in a OOP style to be writing in C++.  C++ is a multi-paradigm language.  It has many styles.  C++ is a language that no one fully learns; you just get better at it.

James C4S

Be careful.  "Best is the enemy of good enough."

The concept of "best" is very relative.  If you are a sharp learner, any resource will point you in a sufficiently positive direction.  Given the vast amount of online information on a generic subject like C or C++ you may not even need a book.
Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

wanderson

A real problem with C++ books as they apply to the Arduino, is that they assume you will be programming on a modern computer and not a micro-controller.  In other words they assume memory is not restricted, which leads to problems when trying to translate the "best practices" to the Arduino environment.
New true random number library available at: http://code.google.com/p/avr-hardware-random-number-generation/

Current version 1.0.1

DVDdoug

Quote
...they assume you will be programming on a modern computer and not a micro-controller.  In other words they assume memory is not restricted...
They also assume you have an interactive keyboard, display, and disk storage! :D    None of the examples in my C/C++ books would run on the Arduino.  Not even "Hello World!"

Docedison

A good knowledge of C and C++ is required as you have figured out. The Language is portable from PC to Anything Else within the limitations of the target device and what the target device Device is capable of. Many times I/O Functions and Methods have to be modified to work as intended or as close to the original intentions as possible to work on the target device. The Common Thread throughout this unnecessary diatribe is that the C and C++ Language was designed for portability. In order to Port a piece of code you first have to know how to write it in C or C++. The device you wish to learn has different I/O conventions than the device you wish to program. I should think that before you get concerned about the differences in the language from the books (I have the same issues too) you should learn it and then perhaps in parallel learn what the Arduino can do and how to do it. Once you will have Three New Things:
1. If you studied hard and did well, you now have a new and possibly lucrative new skill C & C++.
2. You will have learned how to make the Arduino do what you would like and that associated satisfaction.
3. You will have learned a great deal about Your Self in your Progress and The Process required.
Perhaps also how much you really want your dreams.

Doc
--> WA7EMS <--
"The solution of every problem is another problem." -Johann Wolfgang von Goethe
I do answer technical questions PM'd to me with whatever is in my clipboard

5errated

Thanks for the replies and suggestions, I appreciate it.  I'll go scour amazon now.

I'm only getting a beginner's book because they're more of an interesting read.  The "advanced" books read more like a dictionary and bore me to sleep.  Programming isn't new to me.  I use php, js, java, etc.  I have a solid understanding of programming practices and syntax, but am rusty with things like pointers.

Going with the "open" theme of things, they should consider python for arduino in the future.  :D

jraskell



To me, it seems like the thing missing from most programming books is a good overview of what programming is, what it's all about, and what it's good-for, etc.    They just jump-in and start teaching you the language.   



There are, in fact, books that do just that, best example I know of is Code Complete.  There are a variety of others, but the reality is, most people WANT to just jump in and start programming.  This forum is proof of that on a daily (if not hourly) basis.

Go Up