Code size difference

These 2 bits of code toggles an output, but code 1 is 68 bytes smaller than code 2 when compiled.

Why is there so much difference ?

Kim

Code 1 (smaller): //***************************************** void HeartBeat(void) { static byte state; // private variable declared if (state>0) { digitalWrite(Heartbeat,HIGH); state= 0; delay(100); } else { digitalWrite(Heartbeat,LOW); state= 1; delay(100); } return; } //********************************************

Code 2 (bigger): //****************************************** void HeartBeat(void) { static boolean state; // private variable declared here

digitalWrite(Heartbeat,state); state=!state; //toggle output state delay(100);

return; }

Okay, I guess I should look at the assembly listing as well.

Spoke to soon. When I press shift and click compile, all it does is compile normally. I cannot see any assembly code

Any suggestions ?

Using Arduino V1 on Ubuntu

Prior to 1.0, holding the shift key triggered verbose output. Now, it is a setting on the preferences panel.

Okay, changed the setting in preferences to show verbose output during compilation. But I can only see object files, which I cannot read with my editor

Hmm, any suggestions ?

Kim

Avr-objdump

Thanks Didn't know that Linux came with a built in disassembler :-) Command line only, tho. More stuff to remember.