Since Arduino is basically a set of training wheels for working with an atMega32/168 in pseudo C with an incredible amount of excellent documentation/examples, I was wondering if someone was going to do the next step which is show the equivalent code for all the libraries in C?
This would be an amazing way to jump to the next level. I think Lady Ada made some noise about doing something along those lines for her site....
Perhaps "pseudo C" is the wrong description and the syntax is obviously derived from C and you can use C/C++ code inline as well. However an arduino sketch is still obviously a lot simpler than an equivalent C project that has to have far more explicit includes and definitions.
So for a test, pick any specific Arduino sketch example (for an atMega168) and show the exact equivalent with winavr gcc code.
The code you write in the Arduino environment is C/C++. Simple as that. It just comes with a bunch of predefined functions and libraries to make everything easier. All the code is there if you want to look at it. The projects that are created all have cpp files somewhere in the project folder. All the Arduino environment does is refrain from displaying some of the #includes and the main function of the project's code... so it's all there, just not explicitly in Arduino.
You can still compile all the sketches from outside arduino using the avr-gcc tools and rot from the command line, or with makefiles.
Perhaps "pseudo C" is the wrong description and the syntax is obviously derived from C and you can use C/C++ code inline as well. However an arduino sketch is still obviously a lot simpler than an equivalent C project that has to have far more explicit includes and definitions.
So for a test, pick any specific Arduino sketch example (for an atMega168) and show the exact equivalent with winavr gcc code.
As the other posters have said, The Arduino uses standard C syntax. It does add prototypes and includes to the main sketch file in its build process and if you look in the applet subdirectory of any a sketch you can see the content of the source files that are passed to the avr-gcc compiler.
cool! so does that mean arduino sketches are really no less efficient code than if I was using pure C?
My issue right now is that I need to move to a more powerful processor but in order to do this I will have to abandon the arduino platform (unless Arduino will work on the new Xmega series). I am just trying to make this transition smoother.
cool! so does that mean arduino sketches are really no less efficient code than if I was using pure C?
Arduino C is pure C (with some convenient and optional abstractions added). Note however that the abstractions (like digitalRead and digitalWrite) are arduino specific, but you can use standard AVR low level port routines instead if you want.
Your C (or C++) code should run on other avr-gcc platforms. Of course you will need to take into account any differences in the register names and clock speed, but that's not an Arduino issue if you stick to standard C and don't use the arduino specific extensions.
so does that mean arduino sketches are really no less efficient code than if I was using pure C?
Yes, any code you write will compile and run just as efficiently as if you were using "pure C." Keep in mind, however, that the arduino libraries (digitalRead, digitalWrite, etc) are not written with efficiency as their primary goal. The library functions provide a useful simplifying abstraction, and like a lot of abstractions, there is some cost. While IMO the cost is not particularly excessive, you can just skip the arduino "built-in" functions if you're after ultimate speed...