During the initialization routine of my code I use to do such things as:
clr r0 ; will always stay zero
and:
out PORTA, r0; initialize ports
out DDRA, r0
out PORTB, r0
...
Is this actually necessary? Or can I be sure this is automatically done upon reset? Especially, can I rely on all ports to be set as inputs by default so there is no problem with external votages when no code is executed?
