Top "Compiler-warnings" questions

Messages emitted by a compiler which indicate potential problems in code or configuration.

Disable GCC "may be used uninitialized" on a particular variable

I'm getting this warning on a stack variable: warning: object.member may be used uninitialized in this function In this …

c++ gcc compiler-warnings
Why does C++ code missing a formal argument name in a function definition compile without warnings?

While getting started with some VS2005-generated MFC code, I noticed it overrode a method with something like this: void …

c++ compiler-warnings
g++ How to get warning on ignoring function return value

lint produces some warning like: foo.c XXX Warning 534: Ignoring return value of function bar() From the lint manual 534 Ignoring …

c++ gcc g++ return-value compiler-warnings
Understanding -Weffc++

Consider the following program: #include <string> struct S { S (){} private: void *ptr = nullptr; std::string str = ""; }; int main(){} …

c++ pointers g++ compiler-warnings rule-of-three
Boolean expression order of evaluation in Java?

Suppose I have the following expression String myString = getStringFromSomeExternalSource(); if (myString != null && myString.trim().length() != 0) { ... } Eclipse warns me …

java compiler-warnings boolean-logic boolean-expression
strange warning about ExtensionAttribute

I'm getting a strange warning: The predefined type 'System.Runtime.CompilerServices.ExtensionAttribute' is defined in multiple assemblies in the global …

c# compiler-warnings
Is there a way to suppress warnings in C# similar to Java's @SuppressWarnings annotation?

Is there a way to suppress warnings in C# similar to Java's @SuppressWarnings annotation? Failing that, is there another way …

c# java visual-studio compiler-warnings
mixed declarations and codes

When I compile function with "gcc -o dene -Wall -ansi -pedantic-errors dene.c" ,gcc emits no error.(can you look …

c declaration compiler-warnings c89
Why didn't the compiler warn me about an empty if-statement?

I'm using Keil uVision v4.74 and have enabled the option "All Warnings". I wrote the following intentional code: if(condition …

c if-statement compiler-warnings keil
What's up with the thousands of warnings in standard headers in MSVC -Wall?

Some people seem to advise you use -Wall, but when I did it on a small test project which just …

c++ visual-c++ compiler-warnings