On one line

pekkaa:
You can also use direct port manipulation without fors or whiles:

DDRD = DDRD | B0111111;  // pins 2-7

DDRB = DDRB | B10000000; // pin 8

I'm inclined to agree with bperrybap here. In general, the pins are split between different ports, so you don't necessarily even achieve the aim of doing things "in one line". It is also less portable, and much less easy to verify at a quick glance that you are setting the right pins.

The couple of microseconds you might save are not generally needed to be saved. In particular, it is rarely likely that you need to set ports to inputs or outputs "in a hurry".