How can I compile without warnings being treated as errors?
Sure, find where -Werror is set and remove that flag. Then warnings will be only warnings.
Sure, find where -Werror is set and remove that flag. Then warnings will be only warnings.
I’ve only ever used Class.cast(Object) to avoid warnings in “generics land”. I often see methods doing things like this: @SuppressWarnings(“unchecked”) <T> T doSomething() { Object o; // snip return (T) o; } It’s often best to replace it by: <T> T doSomething(Class<T> cls) { Object o; // snip return cls.cast(o); } That’s the only use … Read more
The -Wno-unused-variable switch usually does the trick. However, that is a very useful warning indeed if you care about these things in your project. It becomes annoying when GCC starts to warn you about things not in your code though. I would recommend you keeping the warning on, but use -isystem instead of -I for … Read more
Don’t be afraid! The first part of ReSharper’s warning only applies to removing lists of delegates. In your code, you’re always removing a single delegate. The second part talks about ordering of delegates after a duplicate delegate was removed. An event doesn’t guarantee an order of execution for its subscribers, so it doesn’t really affect … Read more
This is worth a try. You can’t extend Obsolete, because it’s final, but maybe you can create your own attribute, and mark that class as obsolete like this: [Obsolete(“Should be refactored”)] public class MustRefactor: System.Attribute{} Then when you mark your methods with the “MustRefactor” attribute, the compile warnings will show. It generates a compile time … Read more
Your attempts above are adding further flags to your file/target rather than overwriting as you seem to expect. For example, from the docs for Properties on Source Files – COMPILE_FLAGS: These flags will be added to the list of compile flags when this source file builds. You should be able to countermand the -Weffc++ flag … Read more
You are using a function for which the compiler has not seen a declaration (“prototype“) yet. For example: int main() { fun(2, “21”); /* The compiler has not seen the declaration. */ return 0; } int fun(int x, char *p) { /* … */ } You need to declare your function before main, like this, … Read more
Consider: struct A { int i; int j; A() : j(0), i(j) { } }; Now i is initialized to some unknown value, not zero. Alternatively, the initialization of i may have some side effects for which the order is important. E.g. A(int n) : j(n++), i(n++) { }
In the expression (i, ++i, 1), the comma used is the comma operator the comma operator (represented by the token ,) is a binary operator that evaluates its first operand and discards the result, and then evaluates the second operand and returns this value (and type). Because it discards its first operand, it is generally … Read more
The count method of NSArray returns an NSUInteger, and on the 64-bit OS X platform NSUInteger is defined as unsigned long, and unsigned long is a 64-bit unsigned integer. int is a 32-bit integer. So int is a “smaller” datatype than NSUInteger, therefore the compiler warning. See also NSUInteger in the “Foundation Data Types Reference”: … Read more