-Wshadow will "Warn whenever a local variable shadows another local variable.". Is there an equivalent in Visual C++ (2008)? I tried /W4 but it didn't pick up on it. I also tried Cppcheck but that didn't see it either.
e.g. if I inadvertently do:
class A
{
private:
int memberVar;
public:
void fn()
{
int memberVar = 27;
}
};
I would really like to know about it!
Visual Studio's C++ Android development natively supports building your projects with the GCC that ships with the Android NDK, just like it does for Clang. You can also target Linux – either remotely or locally with the Windows Subsystem for Linux – with GCC. Compiler options for GCC.
VS Code is first and foremost an editor, and relies on command-line tools to do much of the development workflow. The C/C++ extension does not include a C++ compiler or debugger. You will need to install these tools or use those already installed on your computer.
Visual Studio C/C++ IDE and Compiler for Windows.
Type “gcc –version” in command prompt to check whether C compiler is installed in your machine. Type “g++ –version” in command prompt to check whether C++ compiler is installed in your machine.
Check out warnings C6244 and C6246
But you will need to enable automatic code analysis to get them, see How to: Enable and Disable Automatic Code Analysis for C/C++
If you cannot do it in your VS edition (Analyzing Managed Code Quality by Using Code Analysis), try to add the /analyze flag to the compilation command line. You will get some warnings that the '/analyze-' flag, which has been added by your IDE, is replaced with the manually added '/analyze' flag, but the analysis will work ;-)
I am afraid no.
You could perhaps try compiling your code with Clang:
We use gcc at work, to build our code, but compile with Clang regularly to test the code conformance to the Standard and benefit from its warnings.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With