Go Down

Topic: Weakness on "Language Comparison" Page (Read 360 times) previous topic - next topic

mikalhart

The Arduino/Processing Language Comparison page (http://www.arduino.cc/en/Reference/Comparison) suggests that in making an Arduino loop we must use this syntax:

[font=Courier]int i;
for (i = 0; i < 5; i++) { ... }
[/font]

as compared to Processing, which embeds the index variable declaration within the loop definition:

[font=Courier]for (int i = 0; i < 5; i++) { ... }
[/font]

This distinction is not strictly correct, as either usage is perfectly valid in Arduino (and C++).  I think both are valid in Java as well, and probably in Processing too.  This section is misleading and should probably be removed.

mh

mem

#1
Aug 12, 2008, 09:01 am Last Edit: Aug 12, 2008, 09:02 am by mem Reason: 1
Quite right.  

And there are some differences that may be worth mentioning, such as :
* The size of the data types is different, so for example integer code that works in processing may overflow on the arduino
* Java has no preprocessor,  so Arduino code using #defines (or macros) need to be re-coded
* Creation of  types using 'new' is not supported on the arduino (it is in C++ but not the version used by the Arduino)

Go Up