I bought my Uno some days ago and have been playing with it since then (Great product by the way!).
I followed a couple of guides (hardware) etc, everything is great!
I was wondering why all the examples and guides (that I've read) were not using the byte type to store pin references instead of int ?
Since memory efficiency is something important when programming in a limited ram environment (as the Uno is), and that byte goes 0 to 255, shouldn't it be preferred over int ? And shouldn't that be taught to beginners(myself included) so that they start with good practices/efficiency in mind?
Int uses 2 bytes,(16bits) while a byte uses.... well, 1 byte(8bits).
Of course, this is not a big improvement as It will only (at most, on an official Uno with 16 pins) saves you 128 bits. (( 16 * 8 * 2 ) - ( 16 * 8 )),
but still, there must be some micro-controllers with less ram and more pins out there.
In C reference is a technical term, being basically the address of a variable.
Yes, if you are tight on memory you would use byte or char (or int8_t or uint8_t)
instead of int where you could, and various other means to reduce memory
footprint, but that's not the first aim of a piece of example code.
Using #define's or const int's to name pin numbers shouldn't have storage overheads.