"It would be very easy to accidentally cause your serial port to stop working by changing pin 0 into an output pin! Now that would be very confusing when you suddenly are unable to receive serial data, wouldn't it?"
So, pins O ("RX") and 1 ("TX") appear to be be particular. What could exactly happen if my code set pin 0 into an output pin (or set pin 1 into an imput pin ?) And how could I fix the serial communication problem mentionned ?
If it's an output pin then you can't receive anything. You could switch it back to an input pin and it will resume normal operation.
These kinds of port operations should only be done when you really need the port function. 99% of the time the standard digitalWrite() or fastDigitalWrite() are better. You make your code harder to read and much harder to transfer onto new hardware when you buy an Arduino Zero or Mega.
I also set pins 0-7 as outputs. I use them for audio output.
I saw the warning you're talking about. (Scary). But nothing bad happened.
I think when you boot an updated sketch, the reset function properly sets pins 0 & 1 back to their original condition so you can upload your new sketch. The warning simply meant you won't be able to use these pins as your serial port while the sketch is running.