Scott Meyers had a point in one of his books that said (I'm paraphrasing) 'Prefer to defer declaration unitl you have a useful value.' His main point was that doing otherwise may lead to Default Constructor and Assignment call, intread of having only one constructor call. Not a hard and fast rule, but, like using ++i; instead of i++; it can make a difference in the lifetime cost of the program.
A side benefit is that it improves logical locality of reference, which may help uderstanding the code.
I prefer locating them as close as I can to use, but in many ways this is personal preference.
A side benefit is that it improves logical locality of reference, which may help uderstanding the code.
I prefer locating them as close as I can to use, but in many ways this is personal preference.