warnings

Code analysis comes back with suggestion about not using “out” parameters

廉价感情. 提交于 2020-01-01 10:53:03
问题 I ran the VS 2008 code analysis tool against an object I created and received the following suggestion ... Warning 147 CA1021 : Microsoft.Design : Consider a design that does not require that 'returnValue' be an out parameter. I find "out" parameters rather useful and didn't realize that they were considered as a frowned upon design practice. I wanted to know if someone could shed some light on the reason that I received this Warning? If it is bad practice? why? and what would be good

Code analysis comes back with suggestion about not using “out” parameters

冷暖自知 提交于 2020-01-01 10:52:06
问题 I ran the VS 2008 code analysis tool against an object I created and received the following suggestion ... Warning 147 CA1021 : Microsoft.Design : Consider a design that does not require that 'returnValue' be an out parameter. I find "out" parameters rather useful and didn't realize that they were considered as a frowned upon design practice. I wanted to know if someone could shed some light on the reason that I received this Warning? If it is bad practice? why? and what would be good

Code analysis comes back with suggestion about not using “out” parameters

梦想的初衷 提交于 2020-01-01 10:51:58
问题 I ran the VS 2008 code analysis tool against an object I created and received the following suggestion ... Warning 147 CA1021 : Microsoft.Design : Consider a design that does not require that 'returnValue' be an out parameter. I find "out" parameters rather useful and didn't realize that they were considered as a frowned upon design practice. I wanted to know if someone could shed some light on the reason that I received this Warning? If it is bad practice? why? and what would be good

Why does this code generate a “Potential resource leak” warning?

南楼画角 提交于 2020-01-01 09:34:28
问题 Eclipse (Juno) gives the following warning: Potential resource leak: 'os' may not be closed at the first line of the try body in this code: static void saveDetails(byte[] detailsData) { OutputStream os = null; try { os = sContext.openFileOutput(DETAILS_FILE_NAME, Context.MODE_PRIVATE); os.write(detailsData); } catch (IOException e) { Log.w(LOG_TAG, "Unable to save details", e); } finally { if (os != null) { try { os.close(); } catch (IOException ignored) { } } } } The method openFileOutput is

c++ bit fields and -Wconversion

試著忘記壹切 提交于 2020-01-01 08:52:54
问题 -Wconversion is producing warnings when I assign a value to a bit field with g++. Source file: struct Foo { public: unsigned int x : 4; unsigned int y : 9; unsigned int z : 17; }; int main(int, char**) { int a = 12; Foo f; f.x = a; f.x = (unsigned int)a; f.x = (unsigned char)a; f.x = (unsigned short)a; f.x = (unsigned)a; f.y = a; f.y = (unsigned int)a; f.y = (unsigned char)a; // no warning, sizeof(char) < 9 f.y = (unsigned short)a; f.y = (unsigned)a; f.z = a; f.z = (unsigned int)a; f.z =

Unchecked assignment for 'java.util.ArrayList'

依然范特西╮ 提交于 2020-01-01 08:43:24
问题 I get the warning: Unchecked assignment for 'java.util.ArrayList' to 'java.util.ArrayList < com.test.mytest >' for: private ArrayList<LocoList> myLocations = new ArrayList(); How to fix it? 回答1: You want new ArrayList<>(); so that you use the right generic type. At the moment you're using the raw type on the right hand side of = . So you want: private ArrayList<LocoList> myLocations = new ArrayList<>(); Or just be explicit: private ArrayList<LocoList> myLocations = new ArrayList<LocoList>();

How can I deal with the ICE60 warning in WiX?

有些话、适合烂在心里 提交于 2020-01-01 07:58:08
问题 I have created a WiX project that installs a bunch of different EXEs and DLLs. Unfortunately when I build the project I receive the following warning for each one of them: ICE60: The file fileName is not a Font, and its version is not a companion file reference. It should have a language specified in the Language column. I have found examples and possible solutions for this and each time it is suggested to set the DefaultLanguage tag to 0 in order to fix the warning. Once doing that I then

How should I promote Perl warnings to fatal errors during development?

半腔热情 提交于 2020-01-01 04:19:09
问题 When running an applications test suite I want to promote all Perl compile and run-time warnings (eg the "Uninitialized variable" warning) to fatal errors so that I and the other developers investigate and fix the code generating the warning. But I only want to do this during development and CI testing. In production, the warnings should just stay as warnings. I tried the following: In "t/lib" I created a module TestHelper.pm: # TestHelper.pm use warnings FATAL => qw( all ); 1; Then called

How to make Visual Studio Handle HTML 5 Tags without warning

眉间皱痕 提交于 2020-01-01 03:56:14
问题 I have various html tags (related to jquery mobile) that Visual Studio is flagging as not valid attributes: For exmaple: <div data-role="page" id="my_id" data-theme="b" data-position="fixed"> Gets amongst others: Validation (XHTML 1.0 Transitional): Attribute 'data-role' is not a valid attribute of element 'div' As you know, data-* are valid attributes of div in HTML 5. I'm not sure how this is validated, though I think via DTDs and xmlns, so the head of the page is the default auto generated

This Handler class should be static or leaks might occur:AsyncQueryHandler

无人久伴 提交于 2020-01-01 02:49:14
问题 Handler reference leaks Since this Handler is declared as an inner class, it may prevent the outer class from being garbage collected. If the Handler is using a Looper or MessageQueue for a thread other than the main thread, then there is no issue. If the Handler is using the Looper or MessageQueue of the main thread, you need to fix your Handler declaration, as follows: Declare the Handler as a static class; In the outer class, instantiate a WeakReference to the outer class and pass this