Actually, you have to be careful when you do this and I would recommend against this. If there is any kind of kink in the chain or you put too much pressure on the pedals, you could screw up your drive train or break your chain.
How do I know this, you ask? Because I've done it. I was out on a training ride in the country on my Cervelo soloist team road bike. I was riding up a very steep hill, I shifted (chain was too stretched) and I dropped my chain. I didn't want to get off my bike, so while trackstanding, I gently shifted my front derailleur and slowly pedaled to get my chain back on my bike. Then all I heard was this crunch, crunch, rip. I immediately jumped off my bike to take a look. I had ripped my rear derailleur off the bike. There must have been a slight kink in the chain. I was in the middle of cow town usa, so I had to call someone to pick me up. The final damage was I needed a new derailleur hanger (the rear derailleur was fine) which runs ~$20. Unfortunatelly when I ripped the rear derailleur off, it damaged my rear wheel to the point where I need a new one. The cost of my rear wheel (I haven't bought a new one yet) will probablly run ~$200-400.
So just be careful if you attempt to try this one!