다음을 통해 공유


PREfast Warning 247 (Windows CE 5.0)

Send Feedback

247 - For-init declaration of <variable> hides declaration of same name in outer scope.
Additional Information: See previous declaration at <location>.

This warning indicates that a local declaration has the same name as a declaration in an outer scope. The name in the outer scope is hidden.

You must understand how the lifetimes of these definitions overlap to determine whether there is a problem with this code. PREfast only identifies a scope overlap.

If the lifetimes of the variables overlap, a problem could exist.

What to look for when investigating this warning:

  • Is the intent a single variable or multiple variables?
  • Is an allocation saved in one variable and freed by the other?
  • Is the correct result being returned?

Example

Defective Source

int Decl1;

{
    for (int Decl1 = 0;;) {
        ;
    }
}

Corrected Source

int Decl1;

{
    for (int Decl2 = 0;;) {
        ;
    }
}

Send Feedback on this topic to the authors

Feedback FAQs

© 2006 Microsoft Corporation. All rights reserved.