Pages: [1]   Go Down
Author Topic: Best C++ Book?  (Read 1237 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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?
Logged

USA
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Offline Offline
Edison Member
*
Karma: 22
Posts: 1164
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.

« Last Edit: June 26, 2012, 07:07:44 pm by DVDdoug » Logged

USA
Offline Offline
Full Member
***
Karma: 0
Posts: 235
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Austin, TX
Offline Offline
Faraday Member
**
Karma: 64
Posts: 6055
Baldengineer
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Capacitor Expert By Day, Enginerd by night.  ||  Personal Blog: www.baldengineer.com  || Electronics Tutorials for Beginners:  www.addohms.com

Dallas, Texas
Offline Offline
God Member
*****
Karma: 3
Posts: 717
Old, decrepit curmugeon
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

New true random number library available at: http://code.google.com/p/avr-hardware-random-number-generation/

Current version 0.7.2

Offline Offline
Edison Member
*
Karma: 22
Posts: 1164
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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! smiley-grin    None of the examples in my C/C++ books would run on the Arduino.  Not even "Hello World!"
Logged

Anaheim CA.
Offline Offline
Faraday Member
**
Karma: 44
Posts: 2810
...
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

--> 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

Offline Offline
Newbie
*
Karma: 0
Posts: 26
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.  smiley-grin
Logged

New Hampshire
Offline Offline
God Member
*****
Karma: 13
Posts: 779
There are 10 kinds of people, those who know binary, and those who don't.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset


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.
Logged


Pages: [1]   Go Up
Jump to: