When using the ObsoleteAtribute in .Net it gives you compiler warnings telling you that the object/method/property is obsolete and somthing else should be used. I'm currently working on a project that requires a lot of refactoring an ex-employees code. I want to write a custom attribute that I can use to mark methods or properties that w...
Following is some obviously-defective code for which I think the compiler should emit a diagnostic. But neither gcc nor g++ does, even with all the warnings options I could think of: -pedantic -Wall -Wextra
#include <stdio.h>
short f(short x)
{
return x;
}
int main()
{
long x = 0x10000007; /* bigger than short */
printf...
I have a couple of nagging compiler warnings for an app that I ported from VB6 a while back regarding CLS-Compliance including:
Name '_AnIdentifier' is not CLS-Compliant.
Type of parameter 'myType' is not CLS-Compliant.
Despite this, my app seems to perform just fine from COM and Managed clients. I have seen several articles describin...
Are C-style macro names subject to the same naming rules as identifiers? After a compiler upgrade, it is now emitting this warning for a legacy application:
warning #3649-D: white space is required between the macro name "CHAR_" and its replacement text
#define CHAR_& 38
This line of code is defining an ASCII value c...
I'm working on a new development in C++, using MS Visual Studio 2005. For this, I need to add several new projects to my solution. I always set my warning level to 4, and turn on "treat warnings as errors" (project -> properties -> c++ -> general).
Is there a way for me to tell Visual Studio that this is my default so I don't have to do...
hi i have a bunch of compile time asserts and do something like
CASSERT(isTrue) or CASSERT2(isTrue, prefix_)
in GCC i get many "warning 'prefix_LineNumber' defined but not used" is there a way i can hide warnings for compile time asserts? i had no luck searching the gcc documentation then thought i may hack something by having the var a...
Is this warning anything to worry about? I've read that it can cause erratic behaviour?
It's an example I'm trying to compile, could someone explain to me why the author declares the object as a class but then typedef's it to a structure? Is it perfectly normal to do so if the class is POD?
Thanks.
...
I know MSVC can do this via a pragma message -> http://support.microsoft.com/kb/155196
Does gcc have a way to print user created warnings or messages? (I couldn't find a solution with google :( )
...
I'm working on a large collaborative C++ project that is both developed and run on various flavors of Linux, OS X and Windows. We compile across these platforms with GCC, Visual Studio C++ and the Intel C++ compiler. As more and more people start developing code for the project, we're starting to see weird errors in compilation and runti...
I am using fully qualified name of the enum inside a method in one of my class. But I am getting compiler warning which says "warning C4482: nonstandard extension used: enum 'Foo' used in qualified name". In C++, do we need to use enums without the qualified name? But IMO, that looks ugly.
Any thoughts?
...
In my app I have a fair number of entities which have fields which are getting their values set via refletion. (In this case NHibernate is setting them). I'd like to get rid of the "x is never assigned to and will always have its default value 0" warnings, so I can more easily pick out the other warnings. I realize you can surround them ...
I'm getting a strange warning:
The predefined type 'System.Runtime.CompilerServices.ExtensionAttribute' is defined in multiple assemblies in the global alias; using definition from 'c:\Program Files\Reference Assemblies\Microsoft\Framework\v3.5\System.Core.dll'
There is no line number given, so it's hard to figure out what it's on abou...
From msdn I get this:
#pragma warning disable warning-list
#pragma warning restore warning-list
In the examples, both disable and restore are used. Is it necessary to restore if I want it disabled for a whole file?
Like, if I do not restore, how far does it carry? Are the warnings disabled for everything compiled after that? Or just ...
We are always taught to make sure we use a break in switch statements to avoid fall-through.
The Java compiler warns about these situations to help us not make trivial (but drastic) errors.
I have, however, used case fall-through as a feature (we don't have to get into it here, but it provides a very elegant solution).
However the co...
So, (seemingly) out of the blue, my project starts getting compiler warning 1685:
The predefined type
'System.Runtime.CompilerServices.ExtensionAttribute'
is defined in multiple assemblies in
the global alias; using definition
from 'c:\Program Files\Reference
Assemblies\Microsoft\Framework\v3.5\System.Core.dll'
Perplexed,...
On the build tab in a Web Application project I have a setting called "Warning Level". I can set a value from 0 to 4. What do these values mean? Will a value of 0 be more strict and generate more warnings, or vice versa? I haven't been able to find any documentation on it yet, but perhaps I'm looking in the wrong place.
...
Hello,
I'm trying to use Micosoft's SAL annotation for my project, however I get the following warning, and I don't know why.
As an example, I created a new C++ console application, and have this code:
#include <sal.h>
class Whatever
{
public:
_Check_return_ int Method(__in int number) ;
};
int main()
{
return 0;
}
When I ...
The little yellow warning symbols and underlines in Eclipse don't last very long, do they?
When I get a warning, after I click on the little warning symbol, I have milliseconds to try to read the warning message before it disappears like a very quick and cautious mouse.
Is there a way to change this or does everyone suffer from this p...
I know unsigned int can't hold negative values. But the following code compiles without any errors/warnings.
unsigned int a = -10;
When I print the variable a, I get a wrong value printed. If unsigned variables can't hold signed values, why do compilers allow them to compile without giving any error/warning?
Any thoughts?
Edit
Comp...
Some compilers let you set warnings as errors, so that you'll never leave any compiler warnings behind, because if you do, the code won't build. This is a Good Thing.
Unfortunately, some compilers don't have a flag for warnings-as-errors.
I need to write a shell script or wrapper that provides the feature.
Presumably it parses the com...