This came up in a thread, but I didn't want to hijack, since it has basically nothing to do with the OP's question.

Since we're supposed to declare variables as locally as possible, does it matter, as far as performance goes, where the variables are declared and initialized? At the beginning of the code? Just before use? Does it depend on the kind of variable? The size of the variable? The size of the program?

I know, as Salem put it, that premature optimization is a terrible disease, but any clarification in this matter would be greatly appreciated. Thanks.