compiler-warnings

Dealing with warnings in c compilations

Hi, I have the following warnings during the compilation: solver.c:24: warning: passing argument 2 of ‘mtrx_multiple’ from incompatible pointer type mat.h:5: note: expected ‘double *’ but argument is of type ‘double **’ solver.c:30: warning: assignment makes pointer from integer without a cast solver.c:39: warning: assignment makes poin...

How can I match a function signature without getting type erasure compiler warnings in Scala.

Hi scala gurus Can anyone re-write this code to do the same thing but without any compiler warnings please:- object TestTypeErasure { def main(args:Array[String]) { def myFunction(myObject:Any):Boolean = { true } val myVariable: (Any => Boolean) = myFunction myVariable match { case function:(Any => Boo...

Implicit Declaration Of Function

I've just organized my code by using headers, but just as I've done this, I got a warning that turned into an error when linking. I have a code(use of a function that is inside a header) in test.c that is like this: #include "test1.h" /* Some code */ main() { Testing(); } And my test1.h header is like this: void Testing(); void ...

Xcode hides warnings after recompile

Take this scenario: after a compile from scratch of a Cocoa Touch project, Xcode may report several compiler warnings in different files. If I fix the warnings in only one of the files and hit Build to see if it works, Xcode will no longer report any warnings in the other files (it will continue showing those in the currently open file ...

C#: writing MSIL to add a preprocessor directive

Is it possible in C# to write MSIL code that will add a preprocessor directive to the code, e.g., #warning, if a certain condition is met? Or maybe this can be done with reflection, I don't know. I'm trying to write a custom attribute that, if applied incorrectly to a class's method or property, will generate a compiler warning. Using...

java unchecked cast

I have a comparator class in Java to compare Map entries: public class ScoreComp implements Comparator<Object> { public int compare(Object o1, Object o2) { Entry<Integer, Double> m1 = null; Entry<Integer, Double> m2 = null; try { m1 = (Map.Entry<Integer, Double>)o1; m2 = (Map.Entry<...

how to supress indivual warnings in C++?

First of all, sorry if this is an obvious question, but I'm rather new to C++. Also, this code is not originally mine, but I am trying to clean it up. I'm looking for a compiler independent way to surpress warnings (preferably) for a specific line. I've got the following code: int MPtag::state_next( int i, int s ){ #if NGRAMS==2 ...

C++ - gcc - how to create my own custom compile warnings similar to printf() ?

howdy. apologies in advance if i use poor terminology. when i compile a C++ app under gdb and use printf() it gives me awesome warnings relating to the consistency of the format string and the arguments passed in. eg, this code: printf("%s %s", "foo"); results in a compiler warning "too few arguments for format", which is super-use...

Is it problematic to assign a new value to a method parameter?

Eclipse has an option to warn on assignment to a method's parameter (inside the method), as in: public void doFoo(int a){ if (a<0){ a=0; // this will generate a warning } // do stuff } Normally I try to activate (and heed) almost all available compiler warnings, but in this case I'm not really sure whether it's worth i...

Warning - Targets a different processor than the application

My .NET 3.5 WPF application has started showing a bunch (14) of the the following warning (with different dlls): Referenced assembly 'C:\WINDOWS\assembly\GAC_32\Microsoft.TeamFoundation \9.0.0.0__b03f5f7f11d50a3a\Microsoft.TeamFoundation.dll' targets a different processor than the application. I am running on a 32 bit machine. The ...

Dynamically typed class generates compiler warnings on method selection.

Perhaps this is the wrong way to go about this, but it seems like such a clean and workable approach that I wonder how I can make the compiler warning go away? @interface SomeView : UIView { NSString *stringOfsomeImportance; RelatedClass *niftyService; } @property (nonatomic, copy) NSString * stringOfnoImportance; @property (nonatomic...

How to resolve this "Resource name is not a valid identifier" compiler warning.

I've got a bunch of Warnings in a Visual Studio 2005 project, most of them are warning me that a resource name is not a valid identifier. example: The resource name 'MB_ArchiveRestore.cs_11' is not a valid identifier. MSDN online help indicates that the resource name needs to be strongly typed, and not contain spaces. What does stro...

Undefined/Unspecified/Implementation-defined behaviour warnings?

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 imposs...

Why does C++ code missing a formal argument name in a function definition compile without warnings?

While getting started with some VS2005-generated MFC code, I noticed it overrode a method with something like this: void OnDraw(CDC* /*pDC*/) { ... // TODO: Add your code here } So of course, as soon as I added something I realized I needed to un-comment the pDC formal argument in order to compile, but I'm confused as to how/w...

warning: assignment from distinct Objective-C type

I've looked though al the previous questions and answers on this error but I can't figure out what I'm doing wrong. Can anyone help? @synthesize myScrollView; @synthesize mathsPracticeTextArray; -(void)loadText { NSBundle *bundle = [NSBundle mainBundle]; NSString *textFilePath = [bundle pathForResource:@"mathspractice" ofType:@...

Can C# compiler be configured to give warning when explicit cast may cause data loss?

Is there a way to configure the VS2008 C# compiler to give a warning for code like this: Int64 x = 123456789000; Int32 y = (Int32)x; ...

How to overcome vc++ warning C4003 while writing common code for both gcc and vc++

I have a code that is compiled in both gcc and vc++. The code has a common macro which is called in two scenarios. When we pass some parameters to it. When we don't want to pass any parameters to it. An example of such a code is: #define B(X) A1##X int main() { int B(123), B(); return 0; } The expect output from ...

Why does the following code not generate a warning in MSVC

I have a section of code that can be summarised as follows; void MyFunc() { int x; ' ' x; ' ' } I would have thought that simply referencing a variable, without modifying it in anyway or using its value in anyway should generate a warning. In VS2003 it does neither, and it I need lint to pick it up. I realise it doesn't effec...

maven prevent denpendency compile

I have a custom jar which including java sources; Maven tries to compile when it builds. How do I skip source compile in the jar file? I have tried such as exclude with some pattern in the compiler-plug in and source directory define but I have not get any luck. Thanks! C05 ...

How do I get missing prototype warnings from g++?

I currently have a project that uses g++ to compile it's code. I'm in the process of cleaning up the code, and I'd like to ensure that all functions have prototypes, to ensure things like const char * are correctly handled. Unfortunately, g++ complains when I try to specify -Wmissing-prototypes: g++ -Wmissing-prototypes -Wall -Werror ...