I'd like to enable the warning for "Variable name hiding" as an error in MSVC++, so that things like this will be flagged as an error:
class A
{
int var ;
A()
{
int var = 5 ; // HIDING: want this to be an error
}
} ;
I'd like to enable the warning for "Variable name hiding" as an error in MSVC++, so that things like this will be flagged as an error:
class A
{
int var ;
A()
{
int var = 5 ; // HIDING: want this to be an error
}
} ;
You can use pragma directives:
#pragma warning(error: 6244)
class A
{
int var ;
A()
{
int var = 5 ; // HIDING: want this to be an error
}
} ;
for Visual Studio 2010 goto "Project Properties -> C/C++ -> Advanced"
there is a treat specific warning as error on the advanced tab of the C++ property pages of your project setting
You can use the /we
compiler option to turn a particular error into a warning. For example, /we6244
will make warning C6244 an error. See the documentation for the /w
option and its friends for details.