Offline
Sr. Member
Karma: 11
Posts: 393
|
 |
« Reply #45 on: November 23, 2012, 10:52:33 am » |
"bool" works... I use it all the time.
Yes, so do I. Why would you even want to use "boolean"? But try "boolean" (which is the "standard" in "Arduino Language") on a C/C++ compiler and see what it thinks of it! (Probably much the same as what I think of it, actually.) And why is "boolean" supposed to be any easier for a beginner than "bool" anyway? It's introducing difference for the sake of difference! Madness.
|
|
|
|
« Last Edit: November 23, 2012, 10:55:54 am by pico »
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 11
Posts: 393
|
 |
« Reply #46 on: November 23, 2012, 11:02:32 am » |
I would add, however, that K&R is probably beyond the comprehension of most C programmers and 99.99% of the arduino community. Without years or programming, making mistakes and tracking down those nasty bugs, it is not possible to appreciate it fully.
I must disagree. I think the book is clear and simply written so that it is very suited to the novice C programmer. It was the first book I bought for learning C, and now of course it is used as a reference. If I knew of a better book to get into C programming, I'd recommend it. I don't, however.
|
|
|
|
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Online
Brattain Member
Karma: 282
Posts: 15443
Measurement changes behavior
|
 |
« Reply #47 on: November 23, 2012, 11:11:04 am » |
"bool" works... I use it all the time.
Yes, so do I. Why would you even want to use "boolean"? But try "boolean" (which is the "standard" in "Arduino Language") on a C/C++ compiler and see what it thinks of it! (Probably much the same as what I think of it, actually.) And why is "boolean" supposed to be any easier for a beginner than "bool" anyway? It's introducing difference for the sake of difference! Madness. So what is your purpose for all your 'arguments'? That the arduino developers should see the sins of their way and redo the platform to attain C/C++ purity? Or is to make sure that beginners be made aware that they are not choosing to take the true path towards C/C++ priesthood by using the arduino IDE? Or that anyone that tells arduino beginners that the arduino platform is using C/C++ as it's programming language are leading them down a destructive path similar to what a crack dealer might do or say? Or is this all about nerds just discussing nerd topic to each other, which I really do enjoy by the way.  Lefty
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 11
Posts: 393
|
 |
« Reply #48 on: November 23, 2012, 11:27:53 am » |
The purpose to all my 'arguments' is to critically examine the claim that "there is no 'Arduino Language' -- it is programmed in C++".
C++ is a standardized programming language. "Arduino language" varies, and in some places varies considerably, from that standard. That's why I think calling it a "dialect" is most appropriate.
Also, don't forget the claim that there is an "Arduino programming language" is proposed by "Team Arduino" itself on the home page of this web site. So it seems quite reasonable for newcomers to come in with that expectation. To be then told "no, there's no 'Arduino programming language', it's just C++" isn't quite accurate, in my opinion.
In any case I don't think it is unreasonable to alert beginners, casual observers, and the unwary generally, to the differences. Or even just that there _are_ differences.
|
|
|
|
« Last Edit: November 23, 2012, 11:33:54 am by pico »
|
Logged
|
|
|
|
|
Left Coast, CA (USA)
Online
Brattain Member
Karma: 282
Posts: 15443
Measurement changes behavior
|
 |
« Reply #49 on: November 23, 2012, 11:34:17 am » |
In any case I don't think it is unreasonable to alert beginners, casual observers, and the unwary generally, to the differences. Your points do have merit I'm sure, don't misunderstand me. What would you suggest be a nice concise and accurate 'standardized' response one should post when a beginner asks "what programming language is the arduino using"? One sentence would be nice if possible, and no nerd words would be helpful.  Lefty
|
|
|
|
|
Logged
|
|
|
|
|
Valencia, Spain
Offline
Faraday Member
Karma: 72
Posts: 2500
|
 |
« Reply #50 on: November 23, 2012, 11:48:05 am » |
... is to make sure that beginners be made aware that they are not choosing to take the true path towards C/C++ priesthood by using the arduino IDE?
I don't think 'bool' vs 'boolean' is the deal breaker, you can fix it with a typedef. The real thing preventing people from gaining their C++ robes is that Arduino doesn't push RAII - nobody's using std::vector or smart pointers. I'd flame people for that on programs for big machines but I'll let it go on the Arduino where you typically only have have a dozen global arrays. On the plus side they're not using C pointers much or any of the other real bad parts of C. This is good - they're not developing any mind-altering habits that'll get carried over to other platforms if they ever start writing code on those machines. The Java people are trying to use "String" and failing but that's just Karma. I try not to interfere with Karma.
|
|
|
|
|
Logged
|
No, I don't answer questions sent in private messages...
|
|
|
|
Offline
Sr. Member
Karma: 11
Posts: 393
|
 |
« Reply #51 on: November 23, 2012, 11:53:05 am » |
[What would you suggest be a nice concise and accurate 'standardized' response one should post when a beginner asks "what programming language is the arduino using"? One sentence would be nice if possible, and no nerd words would be helpful.  How about: "The 'Arduino Language' is a dialect of C/C++ that attempts to make programming simpler for the beginner at the expense of not being completely standard. Refer to this _web page_ for a summary of the important differences from standard C/C++. This will be particularly helpful if you already have experience with programming in C/C++ on other platforms." Something like that. Someone has to write a _web page_, though.
|
|
|
|
|
Logged
|
|
|
|
|
Valencia, Spain
Offline
Faraday Member
Karma: 72
Posts: 2500
|
 |
« Reply #52 on: November 23, 2012, 11:55:19 am » |
The purpose to all my 'arguments' is to critically examine the claim that "there is no 'Arduino Language' -- it is programmed in C++".
C++ is a standardized programming language. "Arduino language" varies, and in some places varies considerably, from that standard. That's why I think calling it a "dialect" is most appropriate.
I think the style of programming is a much bigger difference than the slight differences in semantics. eg. If I had to recommend a book to learn the language the obvious choice is a C++ book. OTOH there's going to be a lot of stuff in that book which is good C++ practice but you shouldn't ever use on the Arduino. A C book doesn't work either, because you'd be missing out on some of the best improvements of C++ over C.
|
|
|
|
|
Logged
|
No, I don't answer questions sent in private messages...
|
|
|
|
Offline
Sr. Member
Karma: 11
Posts: 393
|
 |
« Reply #53 on: November 23, 2012, 12:03:54 pm » |
If I had to recommend a book to learn the language the obvious choice is a C++ book.
I agree it's the _obvious_ choice, but not necessarily the correct one. In any case, there are many reasons not to go too far outside standard C when programming microcontrollers. At lot of C++ stuff is completely inapproriate in a micro environment, and it takes a lot of experience to know what parts of C++ you can sensibly use and what you can't. A C book doesn't work either, because you'd be missing out on some of the best improvements of C++ over C.
A good C book is _perfect_ for the beginner. There is plenty of time later on to learn about all the 'improvements' of C++ over C. And also some of the things that didn't turn out so well... 
|
|
|
|
« Last Edit: November 23, 2012, 12:15:14 pm by pico »
|
Logged
|
|
|
|
|
Valencia, Spain
Offline
Faraday Member
Karma: 72
Posts: 2500
|
 |
« Reply #54 on: November 23, 2012, 12:36:03 pm » |
There is plenty of time later on to learn about all the 'improvements' of C++ over C. And also some of the things that didn't turn out so well...  I think most things made it better. The syntax of some things isn't ideal but you can get used to it. I can only think of one 'big' feature that should never be used under any circumstances - C++ arrays (ie. new[] and delete[]) - ick!
|
|
|
|
|
Logged
|
No, I don't answer questions sent in private messages...
|
|
|
|
UK
Offline
Sr. Member
Karma: 1
Posts: 315
|
 |
« Reply #55 on: November 23, 2012, 02:48:48 pm » |
[What would you suggest be a nice concise and accurate 'standardized' response one should post when a beginner asks "what programming language is the arduino using"? One sentence would be nice if possible, and no nerd words would be helpful.  How about: "The 'Arduino Language' is a dialect of C/C++ that attempts to make programming simpler for the beginner at the expense of not being completely standard. Refer to this _web page_ for a summary of the important differences from standard C/C++. This will be particularly helpful if you already have experience with programming in C/C++ on other platforms." Something like that. Someone has to write a _web page_, though. I'd agree this would be more than an appropriate discription. Best I get reading C :-)
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 114
Posts: 2205
|
 |
« Reply #56 on: November 23, 2012, 06:22:08 pm » |
I think the book is clear and simply written Come back in 10 years and see if you still think so, 
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Sr. Member
Karma: 11
Posts: 393
|
 |
« Reply #57 on: November 23, 2012, 09:03:05 pm » |
I think the book is clear and simply written Come back in 10 years and see if you still think so,  Well, I still think so after owning the book (well, more than one edition) for nearly 30 years. If I start finding it hard to understand after 40 years, I will put that down to dementia, rather than the quality of authorship having changed. I'll let you know. Out of interest, what parts exactly do you think are not clearly and simply written?
|
|
|
|
|
Logged
|
|
|
|
|
Offline
Edison Member
Karma: 114
Posts: 2205
|
 |
« Reply #58 on: November 23, 2012, 09:05:51 pm » |
If I start finding it hard to understand after 40 years, I will put that down to dementia, rather than the quality of authorship having changed. Everytime, if you find that you are discovering new things in the book, you are making progress in understanding C. If you have come to the point where you have stop'd to find new things in the book, two possibilities: 1) programming isn't for you; 2) you are extremely gifted and it is high time for you to write a C book to replace K&R.
|
|
|
|
|
Logged
|
|
|
|
|
Global Moderator
Melbourne, Australia
Offline
Shannon Member
Karma: 226
Posts: 14100
Lua rocks!
|
 |
« Reply #59 on: November 23, 2012, 11:50:54 pm » |
I can only think of one 'big' feature that should never be used under any circumstances - C++ arrays (ie. new[] and delete[]) - ick!
new and delete solve specific problems, it's a pity there is a bug in free, which make the use of them somewhat academic.
|
|
|
|
|
Logged
|
|
|
|
|
|