compiler-warnings

Java: Raw Types vs. Generics [duplicate]

自作多情 提交于 2019-12-12 17:37:26
问题 This question already has answers here : What is a raw type and why shouldn't we use it? (15 answers) Closed 2 years ago . Consider the sample code below /* The new Java 5 or later Generic code */ class TestInserter { public static void main(String[] ar) { List<Integer> myList = new ArrayList<Integer>(); myList.add(20); myList.add(42); Inserter ins = new Inserter(); ins.insert(myList); } } /* Legacy Code */ class Inserter { public void insert(List list) { list.add(new Integer(55)); } }

Suppress GCC warning “extra tokens at end of #include directive”

主宰稳场 提交于 2019-12-12 15:44:43
问题 I'm writing a program in C intended to be compiled and run on a HP NonStop machine. However, I want to do the main development on my workstation running Linux. The HP NonStop C-Compiler requires non-standard #include directives like the following: #include <stdio.h> nolist For each #include directive, my workstation's GCC is complaining: S88USF.c:139:21: warning: extra tokens at end of #include directive How can I suppress this particular warning? Note: On SO, similar questions have already

Pointer-type mismatch with PyArray_SimpleNew

℡╲_俬逩灬. 提交于 2019-12-12 14:26:52
问题 I am creating a module for Python with Numpy using the C API and encounter weird incompatibilities with the output of PyArray_SimpleNew , which I would like to understand. But first a minimal example: # include <Python.h> # include <numpy/arrayobject.h> void foo() { Py_Initialize(); import_array(); npy_intp dims[1] = {42}; PyObject * A = PyArray_SimpleNew(1,dims,NPY_DOUBLE); // Line A Py_Finalize(); } int main() { foo(); return 0; } If I compile this with gcc source.c -lpython2.7 -I/usr

Why does constructing std::string(0) not emit a compiler warning?

你离开我真会死。 提交于 2019-12-12 14:23:13
问题 Say I have this piece of code. #include <string> int main() { std::string(0); return 0; } Writing std::string(0) results in std::basic_string<char>::basic_string(const char*) being called, with 0 as the argument to this constructor, which tries to treat the argument as a pointer to a C-string. Running this code obviously results in a std::logic_error being thrown. But my question is this : why both GCC and MSVC 8.0 don't emit any warnings? I'd expect to see something along the lines of

How do I suppress this COM Generics warning?

心不动则不痛 提交于 2019-12-12 11:25:17
问题 I'm compiling a VB.Net 2.0 app (created in VS2008) using msbuild, and now I've added a generic return type, it's giving me the following: Warning: Type library exporter encountered a generic type instance in a signature. Generic code may not be exported to COM. Having just spent ages removing all of the previous warnings, I don't really want to add a new one. Any idea how to get rid of it (aside from not using generics)? I don't know what details I'd put in the attribute, or what number to

How to find inadvertent object pointer comparisons?

被刻印的时光 ゝ 提交于 2019-12-12 11:04:06
问题 Quick question - Is there a good way to find uses of == with objects instead of isEqual: ? Full story: I had a bunch of code kind of like this: typedef long DataKey; DataKey x; DataKey y; if (x == y) { // do stuff } I now have a need to replace using a long for my DataKey with an object. After creating the class and doing a bunch of global search and replace, my code now is kind of like this: @interface DataKey : NSObject DataKey *x; DataKey *y; if (x == y) { // uh-oh - this is now bad // do

clang++ (version 5) and LNK4217 warning

元气小坏坏 提交于 2019-12-12 07:11:06
问题 I am just learning how to code. I have installed clang version 5 on a windows 10 system using visual studio 14. I created a hello world cpp file to test that is working. Sample code #include <iostream> using namespace std; int main() { cout << "Hello World!\n"; int rip{1}; int dal{4}; int kane = rip + dal; cout << kane; return 0; } command clang++ -o .\bin\testing.exe test.cpp Clang does compile and I get an executable which does run as expected. however I do receive this message. test-3e53b3

Nonnegative width required in format string [duplicate]

蓝咒 提交于 2019-12-12 06:49:12
问题 This question already has answers here : Error: Nonnegative width required in format string at (1) (2 answers) Closed 2 years ago . This is my code which I am trying to compile module vars implicit none real*8,dimension(:,:,:),allocatable :: u,v,w real*8,dimension(:),allocatable :: zets end module vars program post_mean use vars implicit none real*8 rtime,dt,deltax,deltay,rlenz integer itime,nx0,ny0,nz,nzm real*8 pi,pin,hpin,sum,sum1,dum,dum1 real*8 aalpha !Need to hardwire aalpha into output

How to remove shift/reduse warning?

霸气de小男生 提交于 2019-12-12 04:45:15
问题 I am trying to make a compiler and I am now trying to make the parser. I get a warning on this state : State 89 62 expr: '(' expr . ')' 66 | expr . '+' expr 67 | expr . '-' expr 68 | expr . '*' expr 69 | expr . '/' expr 70 | expr . '%' expr 74 | expr . '&' expr 75 | expr . '|' expr 77 cond: expr . 78 | '(' expr . ')' 82 | expr . '=' expr 83 | expr . "<>" expr 84 | expr . '<' expr 85 | expr . '>' expr 86 | expr . ">=" expr 87 | expr . "<=" expr "<>" shift, and go to state 91 ">=" shift, and go

In a static library, Xcode 8.1 does not detect when an objective-c method is not implemented

大兔子大兔子 提交于 2019-12-12 04:35:09
问题 My objective-c project uses a static library and recently I just discovered that Xcode 8.1 does not give some warnings for the library. When a method implementation is missing in the app itself, I get a warning. But if a method implementation is missing in the library, I get no warning. It just crashes at run time. Same for the switch statement with an enum. If a case is missing, Xcode would signal a warning, but not in the static library. In previous versions of Xcode, I am sure I received