Avoid initializing global variables within a small function.

Avoid initializing global variables within a small function. Instead, assign a value during variable definition.

So says http://mspgcc.sourceforge.net/manual/c1408.html. I was just wondering if this is a universally applicable rule, and why it applies.

universally applicable rule

You're the only one calling it a "rule".

Ok then, "guideline".

Apparently there are advantages to following the above rule (sorry, "guideline") when using mspgcc and writing programs for TI MPS microcontrollers. I'm wondering if it holds true for programming in general, and why.

The initialized data segment (see below for examples) is typically prepared by performing a block move (from Flash to SRAM in the case of AVR processor). Block moves are fast and efficient. In most cases, individual assignments (second code set) are a bit slower and require a bit more code (more Flash).

However, we're discussing code that runs exactly once when the Sketch starts. It would be a very rare day when one needs to worry about shaving a few microseconds off the start-up time.

Each method has benefits. A better "guideline" is to use what is most appropriate.

int MyInt = 37;
char PrintMe[] = "Whatever, dude.";
bool RunOnce = true;
float ShortPI = 3.1415;
int MyInit;
char PrintMe[50];
bool RunOnce;
float ShortPI;

void MyInitFunction( void )
{
  MyInt = 37;
  strcpy( PrintMe, "Whatever, dude." );
  RunOnce = true;
  ShortPI = 3.1415;
}

void setup( void )
{
  MyInitFunction();
}