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

learn more… | top users | synonyms

50
votes
7answers
11k views

Custom Compiler Warnings

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 ...
8
votes
4answers
8k views

What are the valid characters for macro names?

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 ...
60
votes
3answers
30k views

What is the list of valid @SuppressWarnings warning names in Java?

What is the list of valid @SuppressWarnings warning names in Java? The bit that come between the ("") in @SuppressWarnings("").
27
votes
6answers
4k views

How to intentionally cause a custom java compiler warning message?

I'm about to commit an ugly temporary hack in order to work around a blocking issue while we wait for an external resource to be fixed. Aside from marking it with a big scary comment and a bunch of ...
7
votes
2answers
848 views

Can I make GCC warn on passing too-wide types to functions?

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 ...
36
votes
3answers
1k views

Does there exist a static_warning?

I'm aware of this question which mentions Boost's "STATIC WARNING", but I'd like to ask again, specifically, how I could implement a static_warning which operates similarly to static_assert but only ...
23
votes
6answers
22k views

How can I hide “defined but not used” warnings in GCC?

I have a bunch of compile time asserts, such as: CASSERT(isTrue) or CASSERT2(isTrue, prefix_) When compiling with GCC I get many warnings like 'prefix_LineNumber' defined but not used. Is there a ...
9
votes
4answers
5k views

Is using #pragma warning push/pop the right way to temporarily alter warning level?

Once in a while it's difficult to write C++ code that wouldn't emit warnings at all. Having warnings enabled is however a good idea. So it is often necessary to disable warnings around some specific ...
9
votes
5answers
13k views

How to suppress Java compiler warnings for specific functions

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, ...
8
votes
6answers
3k views

Why “not all control paths return a value” is warning and not an error?

I was trying to answer this question. As suggested by the accepted answer, the problem with that code is that not all control paths are returning a value. I tried this code on the VC9 compiler and it ...
26
votes
2answers
5k views

Ignore all warnings in a specific file using LLVM/Clang

There are some files in my iOS project that have some warnings, and I want to ignore those warnings. I don't want to disable warnings in the entire project (know how to do that), just some specific ...
18
votes
6answers
1k views

Initialise string function result?

I've just been debugging a problem with a function that returns a string that has got me worried. I've always assumed that the implicit Result variable for functions that return a string would be ...
12
votes
2answers
931 views

Will a “variableName;” C++ statement be a no-op at all times?

In C++ sometimes a variable will be defined, but not used. Here's an example - a function for use with COM_INTERFACE_ENTRY_FUNC_BLIND ATL macro: HRESULT WINAPI blindQuery( void* /*currentObject*/, ...
7
votes
2answers
4k views

Suppressing line specific XCode compiler warnings

Similar to Ben Gottlieb's question, I have a handful of deprecated calls that are bugging me. Is there a way to suppress warnings by line? For instance: if([[UIApplication sharedApplication] ...
18
votes
5answers
34k views

Java Class.cast() vs. cast operator

Having being taught during my C++ days about evils of the C-style cast operator I was pleased at first to find that in Java 5 java.lang.Class had acquired cast method. I thought that finally we have ...

1 2 3 4 5 8
15 30 50 per page