What is the possible disadvantage of putting declarations in inner blocks, instead of at beginning of function?

Posted by shan23 on Programmers See other posts from Programmers or by shan23
Published on 2011-11-11T12:30:55Z Indexed on 2011/11/11 18:26 UTC
Read the original article Hit count: 183

At the place where I work, there are explicit guidelines for placement of declarations of variables. According to that, it is required to put them at the global level and / or at the beginning of functions, and not in inner blocks (such as a for loop). Since they've been specified by persons more experienced than I am, I'm sure that there must be a good reason for it, but I cannot figure out what that might be. It would be nice to know if there are any compile time / run time advantages at having them declared at a bigger scope.

© Programmers or respective owner

Related posts about best-practices

Related posts about c