compiler-warnings

Why do I have warning “C4199 two-phase name lookup is not supported for C++/CLI, C++/CX, or openmp”?

☆樱花仙子☆ 提交于 2019-12-05 18:31:59
I have many templates in my project. Everything is running fine but I've been getting this warning many times for a long time now. Should I keep ignoring it or should I use #pragma warning(disable : 4199) ? BioAbner J Ok Thanks to Simon and Raymond's article I was able to solve it. I no more have that warning anywhere in my code. Just added the command as the article describes at it's very bottom. Here's an image of where exactly I added the command for those like me that might have trouble finding it. 来源: https://stackoverflow.com/questions/56782470/why-do-i-have-warning-c4199-two-phase-name

Where to add -Wall and -Wextra in Xcode 3.1.4

妖精的绣舞 提交于 2019-12-05 15:49:48
I'm trying to figure out where to add extra warning flags like -Wall and -Wextra in Xcode, I'm using version 3.1.4 on Leopard. Apple's documentation is for an old version, if I follow their instructions it takes me to a completely different window than what they show. Also they have a screenshot of a checklist of specific warning flags, I can't figure out how to get to that or even if that's still around. CLARIFICATION: I'm building an iPhone app... bbum pointed me to the right spot for an OS X app, but the options are different for an iPhone project and I don't see an obvious analogue. In the

casting a pointer to integer issues warning on 64bit arch

寵の児 提交于 2019-12-05 15:04:02
I'm writing a linux kernel module that makes use of the exported symbol open_exec struct file *open_exec(const char *name) It returns a pointer, and I can check for an error with the IS_ERR macro: if (IS_ERR(file)) return file; During compile time, I get this warning: warning: return makes integer from pointer without a cast This is because my function here returns an integer. If I try to cast it: return (int) file; I don't get a warning on my 32bit machine, but I do on my 64bit machine: warning: cast from pointer to integer of different size This is because the sizeof of an int and a pointer

Strange “Resource leak: stream is never closed” with try-with-resources if Exception is thrown in a loop

半城伤御伤魂 提交于 2019-12-05 12:03:13
问题 Why is Eclipse giving a strange "Resource leak: zin is never closed" warning for the following code even though I use try-with-resources : Path file = Paths.get("file.zip"); // Resource leak warning! try (ZipInputStream zin = new ZipInputStream(Files.newInputStream(file))) { for (int i = 0; i < 5; i++) if (Math.random() < 0.5) throw new Exception(); } catch (Exception e) { e.printStackTrace(); } If I modify "anything" on the code, the warning goes away. Below I list 3 modified versions which

Is it possible to disable specific compiler warnings?

做~自己de王妃 提交于 2019-12-05 11:36:52
I am trying to suppress specific compiler warnings, namely System.Data.OracleClient.OracleConnection' is obsolete . I came upon these questions here: How to disable specific warnings for the entire solution? Globally suppress c# compiler warnings ...but they don't seem to apply to VS2013. When I go to my project's properties, I don't see a Build tab. I see a Compile tab, but it doesn't appear to have a place to specify warning messages to suppress. I see a section there called Warning configurations , but I don't see the warning I am looking for. Update: It turns out that I am trying to do

Undefined/Unspecified/Implementation-defined behaviour warnings?

ぐ巨炮叔叔 提交于 2019-12-05 10:51:16
Can't a compiler warn (even better if it throws errors) when it notices a statement with undefined/unspecified/implementation-defined behaviour? Probably to flag a statement as error, the standard should say so, but it can warn the coder at least. Is there any technical difficulties in implementing such an option? Or is it merely impossible? Reason I got this question is, in statements like a[i] = ++i; won't it be knowing that the code is trying to reference a variable and modifying it in the same statement, before a sequence point is reached. Alok Singhal It all boils down to Quality of

Const correctness warnings c++

蹲街弑〆低调 提交于 2019-12-05 09:39:12
问题 Does anyone know of any warnings that C++ compilers provide that help to enforce const correctness? For instance, it would be nice to have a warning produced by any C++ method that contains a non-const parameter that is never modified inside of the method. I see that there is a gnu compiler warning called -Wsuggest-attribute=const; however, when I use this flag I get an error saying that it is not recognized. Any ideas why? 回答1: I don't think such a warning exists, mostly because it would be

Telling gcc diagnostics apart

大城市里の小女人 提交于 2019-12-05 09:23:28
I have a problem interpreting gcc (4.8.2) warnings & errors. More precisely, it's difficult to tell where one problem ends and another one starts. I have console-only access to the build machine, so using an IDE is not an option. I really need to be able to tell individual issues apart quickly. Is there a way to make GCC insert something between distinct diagnostic messages? Here is an example output I am getting: /usr2/viewstore_some/xy01/xy01_unix1/fubar/extensions/xmodel/core/code/src/DataItemCollection.cpp: In member function ‘virtual bool xmodel::Core::DataItemCollection:

bootstrap class path not set

拈花ヽ惹草 提交于 2019-12-05 09:03:01
问题 So I am getting- warning: [options] bootstrap class path not set in conjunction with -source 1.6 And I am about to ask 3 questions about it. I understand that I need to set the bootstrap class path but I am not sure I understand how. A quick google just sent me to pages that quoted from the Oracle page, but I read the Oracle page and didn't feel that I understood it particularly well. I am currently running this code on Netbeans, so all I have to do is hit the play button for it to compile

Why is GCC tricked into allowing undefined behavior simply by putting it in a loop?

若如初见. 提交于 2019-12-05 08:53:32
问题 The following is nonsensical yet compiles cleanly with g++ -Wall -Wextra -Werror -Winit-self (I tested GCC 4.7.2 and 4.9.0): #include <iostream> #include <string> int main() { for (int ii = 0; ii < 1; ++ii) { const std::string& str = str; // !! std::cout << str << std::endl; } } The line marked !! results in undefined behavior, yet is not diagnosed by GCC. However, commenting out the for line makes GCC complain: error: ‘str’ is used uninitialized in this function [-Werror=uninitialized] I