C is very nearly a subset of c++ so most of the stuff you actually write can be plain C. (Maybe all of it; I don't use arduino).
C is very nearly a subset of c++ so most of the stuff you actually write can be plain C. (Maybe all of it; I don't use arduino).
-- John Devereux
That is quite possible - we don't order in anything like those sizes, so I don't know exact figures.
I do know that Atmel uses a design process that is quite flexible for putting together microcontrollers from modules, so I suspect their cut-off points are lower than for many other manufacturers. But they will still be high, especially if the saving is only for a small bit of flash (which is not particularly big in die area, and therefore cheap).
Of course it was silly! When we realised the pricing structure, we always bought the 32K version even though the code was linked for the 8K version.
In theory, these OTP versions of the devices were aimed at low volume and prototyping - high volume customers were expected to buy masked ROM versions where the pricing structure was more logical.
Quite true. There are only a few places where C and C++ depart and tend to be issues you won't likely encounter. The few that do come up are the stuff of "cute" examination questions.
You'll want to leave some of that K&R baggage behind though, to avoid a ton of compiler warnings. The most obvious being function prototypes.
Warren
I'd sooner turn-off the "ton of compiler warnings" and retain the K&R "baggage" thanks all the same. K&R wrote the most outstanding manual on the C language many years ago and it's never been bettered for its sheer unambiguity, clarity and precision of English. Very few authors can write technical books to that standard. In our own neck of the woods here, John Fields certainly could and Win Hill likewise (on a good day anyway). Can't think of any others, tho'.
The second edition uses C89, so you can have prototypes and K&R too.
Cheers
Phil Hobbs
The K&R book is a fine piece of technical writing. But the C language has improved greatly since their book - you would do better to read the book to understand the ideas of C, then read a more modern text or reference to understand the current language. And turn the warnings up full on your compiler.
Do you have a favourite that is still in the spirit of K&R?
John
I found Harbison and Steele invaluable as a reference work.
-- John Devereux
No, sorry. It's so long since I read a C book that I don't remember which ones I looked at (other than K&R, of course). The N1570 draft of the C11 standard is easily found online, and it is the ultimate reference document for the language. But it is not as "readable" as K&R.
Thanks. John Devereux mentioned Harbison & Steele which seems to be widely liked. I just ordered a copy to supplement my K&R 2nd ed. John
ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.