compiler-warnings

Disable one unused variable warning

混江龙づ霸主 提交于 2019-12-14 03:45:19
问题 How can I disable one warning in one place only? I have one variable which I temporarily don't use. Xcode shows me a warning about the "unused variable". I want to disable the warning, but for this variable only, not all warnings of this type. Is it possible without setting/getting this variable's value? 回答1: From GCC / Specifying Attributes of Variables (understood by Clang as well): int x __attribute__ ((unused)); or int y __attribute__((unused)) = initialValue ; 回答2: It's pretty simple:

warning: extended initializer lists only available with std c++ 11 [closed]

不羁岁月 提交于 2019-12-14 03:36:31
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Getting warning while using below code: warning: extended initializer lists only available with std c++ 11 struct test{ int a; int b; }; //Previously const test atest[] = { {2,3} {4,5} }; const test atest[] = { {2,3} , {4,5} }; How can I remove this? I tried with solution, but it didn't work. 回答1: const test

eclipse: no warning for unused private methods

心已入冬 提交于 2019-12-14 03:15:42
问题 Regarding eclipse Kepler SR1 Hi, I remember that a unused private methods were getting a warning from the compiler. I don't know if it's changed switching to Kepler (or a previous release) or if it is project settings, because I'm working on a new project where the eclipse settings are shared. I even couldn't find the setting in the eclipse compiler settings. 回答1: go to your project on "Package Explorer", right-click on it and choose "properties". Then inside properties "Java Compiler",

How to get rid of “inline function used but never defined” warning in g++

一笑奈何 提交于 2019-12-14 01:11:54
问题 I'm using mingw-w64. I'm including strsafe.h and getting the following warning: warning: inline function 'HRESULT StringCchPrintfA(STRSAFE_LPSTR, size_t, STRS AFE_LPCSTR, ...)' used but never defined [enabled by default] The only flags flags I used are -Wall -DDEBUG -g . I know that you have to define inline functions in the same header and I looked at strsafe.h and I clearly can see that StringCchPrintfA in the header, so I don't know why its giving me this error. Also, here is a link to

How can I disable/suppress the warning sound played whenever I am building and have warnings?

妖精的绣舞 提交于 2019-12-13 21:19:05
问题 My question today is right to the point. So whenever I build my project or my solution and there is a warning about anything such as a deprecated method, visual studio plays an annoying warning sound and I don't know how to disable the warning sound from being played. I know how to set it so that none of the warnings show up, but the warning sound still plays. Please, if anybody reading my question knows how to disable the warning sound played when visual studio encounters a warning while

Weird warning : “is assigned but its value is never used”

允我心安 提交于 2019-12-13 09:35:45
问题 I'm posting this message because I'm wondering about a warning I got in my c# code: the private field xxxx is assigned but its value is never used The attribute in question is only use as a flag for the user. Indeed the user can access (get) the value false or true to know a state of something. Here is an example of code which create this warning : class Class1 { //Attributs private b_myboolean = false; //Accessors public bool B_myboolean { get{ return b_myboolean;} } //Methods //Somewhere in

Compiling a Java USB program with unusual errors/warnings [duplicate]

荒凉一梦 提交于 2019-12-13 08:20:02
问题 This question already has an answer here : javax.usb.UsbException: Properties file javax.usb.properties not found (1 answer) Closed 6 years ago . I was developing a USB reading Java program to get the name of the attached USB device. This is the code I wrote: import java.io.UnsupportedEncodingException; import java.util.List; import javax.usb.*; import javax.usb.UsbDevice; import javax.usb.UsbDisconnectedException; import javax.usb.UsbException; import javax.usb.UsbHostManager; import javax

warning: ignoring return value of ‘realloc’, declared with attribute warn_unused_result

谁说我不能喝 提交于 2019-12-13 07:13:51
问题 I'm curious, I'm programming in C on PuTTy, does anyone know how I can get rid of this warning? warning: ignoring return value of ‘realloc’, declared with attribute warn_unused_result [-Wunused-result] realloc(strp->data, nbytes); ^ Relevant code to the line it wants to 'warn' me about: //If the previously allocated size is > 0 then we can reallocate //otherwise we have to make a new allocation in memory if(strp->length > 0) { realloc(strp->data, nbytes); } else { *strp = kstralloc(nbytes); }

Compiler warnings for execvpe function

爷,独闯天下 提交于 2019-12-13 06:46:24
问题 I have a program written in c which uses the execvpe(3) function, and I've got a line set to include the requisite header file: #include <unistd.h> I compile this file with the following command... gcc foo.c -o foo ...only to get the following warning: warning: implicit declaration of function ‘execvpe’ [-Wimplicit-function-declaration] I've encountered similar behavior with files that reference the pthread_create(3) function. The difference is obviously that whereas the pthread_create(3) man

Code Analysis Warning CA1004 with generic method

左心房为你撑大大i 提交于 2019-12-12 19:12:28
问题 I have the following generic method: // Load an object from the disk public static T DeserializeObject<T>(String filename) where T : class { XmlSerializer xmlSerializer = new XmlSerializer(typeof(T)); try { TextReader textReader = new StreamReader(filename); var result = (T)xmlSerializer.Deserialize(textReader); textReader.Close(); return result; } catch (FileNotFoundException) { } return null; } When I compile I get the following warning: CA1004 : Microsoft.Design : Consider a design where