Just a simple question, I noticed if a function is not used anywhere (never called), it is still compiled. In another language that I use frequently (PAWN), there is the prefix keyword "stock", that tells the compiler "if the function is not used anywhere, do not include it".
With the Arduino IDE this is automatic as long as the function is never referenced by your code it will be stripped from the code uploaded to your Arduino.
EDIT: The IDE will compile your code with a 'compiler' converting it to 'assembler' source which is passed to the 'assembler' which outputs 'object code' which is passed to the 'linker' which links your code with the Arduino library. The 'linker' will strip any code that your 'sketch' does not reference directly or indirectly.
A while back a gang of us was trying to get complile sizes down to minimal as a pissing contest, the difference in that example code from 1.0 and 0.22 was over 20 bytes with nothing else changed
so it seems that not everything is stripped if you don't reference it, though I dont think its really functions, its more like features added to functions
guix:
Just a simple question, I noticed if a function is not used anywhere (never called), it is still compiled. In another language that I use frequently (PAWN), there is the prefix keyword "stock", that tells the compiler "if the function is not used anywhere, do not include it".
Ah yes, well the Hardware Serial implementation on the Mega2560 instantiates 4 serial objects even if you don't want them. I suspect they stay there because they are initialized in init().