compiler-warnings

How do warnings on undefined selectors work in Objective C?

对着背影说爱祢 提交于 2019-12-24 16:02:57
问题 Is there any way to make the compiler raise a warning when calling a selector that is not defined ? For example, I have this call somewhere : methodcall time1:[[self.H1time copy] stringValue] stringValue method does not exist anymore in the H1time class and the compiler did not raise anything. copyWithZone is declared as - (NSHour*)copyWithZone:(NSZone *)zone; The compiler raises a warning inside NSHour if I call [self stringValue] . but not in methodcall time1:[[self.H1time copy] stringValue

How to configure Visual Studio not to output warnings from libraries?

纵饮孤独 提交于 2019-12-24 11:37:51
问题 Is there any way to prevent Visual Studio from printing out warnings from included libraries? \Wall gives me loads of warnings from STL and Qt headers, although I only want to see those originating from my own code (i.e. the code which is part of the current Visual Studio project). 回答1: You can use pragma to set the warning levels for each file. So before you include #pragma warning( push ) #pragma warning( disable : 4705 ) #pragma warning( disable : 4706 ) #pragma warning( disable : 4707 ) /

-Wundef and -Werror=undef aren't working together in MinGw 4.4.1

倖福魔咒の 提交于 2019-12-24 10:59:54
问题 According to the GCC documentation -Wundef emits a warning when an undefined identifier is used in a #if directive and -Werror= displays the specified warning as error But they are not working together in MinGW 4.4.1. Although -Wundef works and -Werror (to display all warnings as error) work. Is this a known issue? Any workarounds available? 回答1: Looks like there's a problem with MinGW 4.4.1 Worked like a charm in 4.6.2 来源: https://stackoverflow.com/questions/13953707/wundef-and-werror-undef

what is the difference between warnings C4018 ('expression' : signed/unsigned mismatch) and C4389 ('operator' : signed/unsigned mismatch)

好久不见. 提交于 2019-12-24 08:26:57
问题 so what is the difference between C4018 ('expression' : signed/unsigned mismatch) and C4389 ('operator' : signed/unsigned mismatch) warnings? unsigned int uc = 0; int c = 0; if (uc < c) uc = 0; // C4018 vs int a = 9; unsigned int b = 10; if (a == b) // C4389 I just don't get it. 回答1: Biggest difference is the warning level at which these diagnostic messages are generated. C4018 is a level 3 warning. Falls in the "things you should not ignore" category. Just try the code you have with uc = 1

How can I see warnings in Linqpad?

孤人 提交于 2019-12-24 06:03:36
问题 When I create C# Programs in LinqPad, I would like to see the warnings from the compiler. It already shows error messages. How can I see the warnings? 回答1: LINQPAD is not a full blown IDE to support everything.. it's an ergonomic C#/VB scratchpad that instantly executes any C#/VB expression, statement block or program.. so simply this feature is not supported as of now. 来源: https://stackoverflow.com/questions/4951069/how-can-i-see-warnings-in-linqpad

How can I see warnings in Linqpad?

爷,独闯天下 提交于 2019-12-24 06:02:29
问题 When I create C# Programs in LinqPad, I would like to see the warnings from the compiler. It already shows error messages. How can I see the warnings? 回答1: LINQPAD is not a full blown IDE to support everything.. it's an ergonomic C#/VB scratchpad that instantly executes any C#/VB expression, statement block or program.. so simply this feature is not supported as of now. 来源: https://stackoverflow.com/questions/4951069/how-can-i-see-warnings-in-linqpad

No compiler warning for returning a reference to local variable

走远了吗. 提交于 2019-12-24 04:17:34
问题 Using: g++ -Wall -ansi foo.cpp I get the warning foo.cpp:31: warning: reference to local variable ‘x’ returned from the function : int &bar(int x) { return x; } but, removing that function from the file, I get no warning from the following function: int &get_max(int x, int y) { return x > y ? x : y; } Why does the compiler allow this? 回答1: It looks like a bug, the warning is inconsistent, if we turn on optimization in gcc 5.1 it does catch this case: warning: function may return address of

How to get the compiler to warn that this is an invalid bool?

拜拜、爱过 提交于 2019-12-24 03:51:40
问题 We just got burnt by a typo: " constexpr bool maxDistance=10000; " Both gcc and clang compile this with no warning. The real error here is that the variable shouldn't have been of type bool, but should have been an integer type instead. How can we ensure we get a compiler warning in future? #include <iostream> constexpr bool number = 1234; int main(int argc, char* argv[]) { std::cout << number + 10000 << std::endl; // prints 10001. return number; } The error here is that the variable is

Does Roslyn actually allow you to manipulate TreatWarningsAsErrors for a CSharp project?

时光总嘲笑我的痴心妄想 提交于 2019-12-24 02:54:08
问题 I'm trying to retrieve the setting TreatWarningsAsErrors, but I'm unable to find it for a project of my loaded solution. What I'm trying to accomplish, is to get the setting from the project files, and set it to true , if it's not already that. Next, I want to let Roslyn do a compilation with the new setting, so I can check if this will break the project. I've looked at various places, among others, the Project.CompilationOptions . Most options to a project build are there, except this one.

How to find out the number of a C++ warning

本小妞迷上赌 提交于 2019-12-24 02:24:04
问题 I have turned on -Wall in my code to get rid of all warnings. Some however I want to allow within the code, so I disable those ones in code. Of the common ones, I can easily find out the warning number in Google and disable them like e.g.: #pragma warning( disable : 4127 ) But of some, I can't possibly find the corresponding number. For example, I want to disable a: warning : array subscript is of type 'char' [-Wchar-subscripts] How do I find its number? Is there a searchable list? The