Go Down

Topic: Programming in C (Read 5796 times) previous topic - next topic

pico

#45
Nov 23, 2012, 04:52 pm Last Edit: Nov 23, 2012, 04:55 pm by pico Reason: 1

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

WiFi shields/Yun too expensive? Embeddedcoolness.com is now selling the RFXduino nRF24L01+ <-> TCP/IP Linux gateway: Simpler, more affordable, and even more powerful wireless Internet connectivity for *all* your Arduino projects! (nRF24L01+ shield and dev board kits available too.)

pico


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.

WiFi shields/Yun too expensive? Embeddedcoolness.com is now selling the RFXduino nRF24L01+ <-> TCP/IP Linux gateway: Simpler, more affordable, and even more powerful wireless Internet connectivity for *all* your Arduino projects! (nRF24L01+ shield and dev board kits available too.)

retrolefty



"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  

pico

#48
Nov 23, 2012, 05:27 pm Last Edit: Nov 23, 2012, 05:33 pm by pico Reason: 1
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.

WiFi shields/Yun too expensive? Embeddedcoolness.com is now selling the RFXduino nRF24L01+ <-> TCP/IP Linux gateway: Simpler, more affordable, and even more powerful wireless Internet connectivity for *all* your Arduino projects! (nRF24L01+ shield and dev board kits available too.)

retrolefty

Quote
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

fungus


... 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.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

pico


[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.
WiFi shields/Yun too expensive? Embeddedcoolness.com is now selling the RFXduino nRF24L01+ <-> TCP/IP Linux gateway: Simpler, more affordable, and even more powerful wireless Internet connectivity for *all* your Arduino projects! (nRF24L01+ shield and dev board kits available too.)

fungus


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.
No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

pico

#53
Nov 23, 2012, 06:03 pm Last Edit: Nov 23, 2012, 06:15 pm by pico Reason: 1

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... ;)
WiFi shields/Yun too expensive? Embeddedcoolness.com is now selling the RFXduino nRF24L01+ <-> TCP/IP Linux gateway: Simpler, more affordable, and even more powerful wireless Internet connectivity for *all* your Arduino projects! (nRF24L01+ shield and dev board kits available too.)

fungus


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!

No, I don't answer questions sent in private messages (but I do accept thank-you notes...)

jtw11



[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 :-)

dhenry

Quote
I think the book is clear and simply written


Come back in 10 years and see if you still think so, :)

pico


Quote
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?
WiFi shields/Yun too expensive? Embeddedcoolness.com is now selling the RFXduino nRF24L01+ <-> TCP/IP Linux gateway: Simpler, more affordable, and even more powerful wireless Internet connectivity for *all* your Arduino projects! (nRF24L01+ shield and dev board kits available too.)

dhenry

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


Nick Gammon


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.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Go Up