[previous] 2547 [next] This declaration of tag '%s' hides a more global declaration.
Declarations and definitions

This tag declaration will 'hide' another tag with the same name declared previously at a wider scope. The previous declaration will remain hidden for the remainder of this scope. Usage of this identifier which might be intended to refer to the previous tag will now refer to the local one instead.

This could be the result of trying to use the same tag for a struct and a union (or an enum). In the C language, all tags occupy the same name space. Hiding of identifiers is confusing and dangerous and should be avoided.

For example:


/*PRQA S 750,2017,2213,2216,3408,3629 ++*/

struct XT {int a; int b;};

void foo(void)
{
    union XT {float f; long t;};       /* Message 2547 */
}

See also:

QA·C Source Code Analyser 8.1.2
© 2013 Programming Research.
www.programmingresearch.com
Personality Groups | Glossary | Message Index Contents