compiler-warnings

Unchecked conversion when popping stack Java

I'm new to Java and have a question about a warning: My general code: private Stack<ArrayList> stackFrame = new Stack<ArrayList>(); private ArrayList<Object> curBlocKList = new ArrayList<Object>(); ... curBlockList = stackFrame.pop(); I'm getting: Parser.java:78: warning: [unchecked] unchecked conversion found : java.util.ArrayLis...

java: how to use clone() and what about the cast check

This code: class RawStringIterator { java.util.Stack<State> stateStack = new java.util.Stack<State>(); RawStringIterator(RawStringIterator i) { stateStack = (java.util.Stack<State>) i.stateStack.clone(); } /* ... */ } gives me this warning: Type safety: Unchecked cast from Object to Stack...

The parameter 'foo' should not be assigned -- what's the harm?

Compare this method: void doStuff(String val){ if(val == null){ val = DEFAULT_VALUE; } //lots of complex processing on val } ... to this method: void doStuff(String origVal){ String val = origVal; if(val == null){ val = DEFAULT_VALUE; } //lots of complex processing on val } For the form...

Are standard library warnings normal?

I'm learning my way around visual studio at the moment. If I've turned set /Wall -- I'll be greeted with a seemingly unhealthy amount of warning messages although my application will compile just fine. Is this normal? Changing the error level will stop the messages. It looks as if they are all related to the C++ STL or its header files ...

Calling a method back on the parent controller without a warning message

I have a front-view and a flip-view much like the utility weather-app. To avoid dealing with the complexities of protocols... on my flipView I need to call some code that resides back on my front-view. This works... but generates a warning during compile. [self.parentViewController returningFromGetStringView]; Warnings (shows twice)...

What 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 has a main.cpp with some includes, I get 5800 warnings most of them in standard headers or in windows headers. Is that intended behaviour? How do I go about making my compilation warning free? Here are just a few for some reading fun: 1>c:\p...

What does this mean: "warning: comparison between 'enum A<B>' and 'enum A<B>'"?

I added following at line 42 of proto.h: typedef boost::make_unsigned<off_t>::type uoff_t; And now I get this verbose and confusing warning from gcc complaining about comparing an enum to the same enum type: In file included from proto.cpp:12: /usr/local/include/boost/type_traits/is_unsigned.hpp: In instantiation of 'boost::detail::i...

Why am I getting a "statement with no effect" warning?

The following is my code /* Initialise default without options input. */ options -> processHiddens = false; options -> timeResolution = DEFAULT_MOD_TIMES; options -> performSync = true; options -> recursive = false; options -> print = false; options -> updateStatus = true; options -> verbose = false; options -> programname = malloc(BUFS...

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*/, REFIID iid, void** ppv, DWORD_PTR /*param*/ ) { DEBUG_LOG( __FUNCTION__ ); //DEBUG_LOG macro expands to an empty string in non-debug ...

Turn off code contracts warning

I want to turn off a code contract warning, but only for specific code lines. How do I do that? For instance, I get: Warning 87 CodeContracts: requires unproven: key != null for: return HttpContext.Current.Items[typeof(T).AssemblyQualifiedName]; which will never happen in our applications. ...

How to supress C# warning CS0675 : Bitwise-or operator used on a sign-extended operand

Hi, I can't seem to get rid of this warning for the following line of code: d.word[wrdIndex++] = d.GetWord(english) | (ulong)i; the warning applies to the code after the assignment operator. the method GetWord returns a ulong. I've tried the following to no avail: d.word[wrdIndex++] = (d.GetWord(english) | (ulong)i); d.word[wrdIndex+...