compiler-warnings

Objective-C method implementation nuances

I have just started to develop for the iPhone and am in the process of learning Objective-C. I have seen some code that implements a method in the @implementation side of a class like this: -(void)myMethod; { // method body } What makes this interesting is that there is no mention of myMethod in the @interface for the class. I trie...

No method found compiler warning

I have create a class from a string, check it is valid and then check if it responds to a particular method. If it does then I call the method. It all works fine, except I get an annoying compiler warning: "warning: no '-setCurrentID:' method found". Am I doing something wrong here? Is there anyway to tell the compiler all is ok and ...

mixed declarations and codes

When I compile function with "gcc -o dene -Wall -ansi -pedantic-errors dene.c" ,gcc emits no error.(can you look a line which starts with char ....,in if loop,) static void remove_negation(char *s,char *s1) { char **cmainp=malloc(sizeof(char*)*1); int len=0;int d=0; int i=0; ...

Deciphering a queer compiler warning about unsigned decimal constant

This large application has a memory pool library which uses a treap internally to store nodes of memory. The treap is implemented using cpp macros, and the complete file trp.h can be found here. I get the following compiler warning when I attempt to compile the application: warning: this decimal constant is unsigned only in ISO C90 By...

In Haskell, what does it mean if a binding "shadows an existing binding"?

I'm getting a warning from GHC when I compile: Warning: This binding for 'pats' shadows an existing binding in the definition of 'match_ignore_ancs' Here's the function: match_ignore_ancs (TextPat _ c) (Text t) = c t match_ignore_ancs (TextPat _ _) (Element _ _ _) = False match_ignore_ancs (ElemPat _ _ _) (Text t) = False match_ig...

VS2010 (older) installer project - two or more objects have the same target location.

This installer project was created back in 2004 and upgraded ever since. There are two offending dll files, which produce a total of 4 errors. I have searched online for this warning message and did not find a permanent fix (I did manage to make it go away once until I have done something like a clean, or built in Release, and then in ...

Avoid incompatible pointer warning when dealing with double-indirection

Assuming this program: #include <stdio.h> #include <string.h> static void ring_pool_alloc(void **p, size_t n) { static unsigned char pool[256], i = 0; *p = &pool[i]; i += n; } int main(void) { char *str; ring_pool_alloc(&str, 7); strcpy(str, "foobar"); printf("%s\n", str); return 0; } ... is it pos...

Code Analysis Warning CA1004 with generic method

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(textRead...

List of all gcc diagnostics

I need a link to a webpage that lists all the error messages and warnings GCC can show; the actual messages, not descriptions. It would be preferable if the list is in the order of most frequently encountered diagnostics. ...

c++: truth assignment warning with arguments?

I use the following to work with arguments in my programs, but it seems to just hand me a warning (just a warning): "warning: suggest parentheses around assignment used as truth value" The beginning of the code is as follows: while((++argv)[0] && argv[0][0]=='-'){ while(c =* ++argv[0]) The while(c =* ++argv[0]) part being wh...

persistant '<class>' may not respond to +method

I've found a bunch of posts on this problem and have actually managed to removed one of the warnings i was getting from these however one persists. Some context: I'm creating currency converter as an exercise in learning Objective C My Rate class represents a rate that a currency can be converted to or from looks like this: Rate.h //...

Can I configure the compiler in Visual Studio to give warnings / errors for all non-localized strings?

I would like the compiler to detect all non-localized strings in my solution. This means any string in an .aspx or .cs file that doesn't come from a resource file. ...

Avoid warning 'Unreferenced Formal Parameter'

I have a super class like this: class Parent { public: virtual void Function(int param); }; void Parent::Function(int param) { std::cout << param << std::endl; } ..and a sub-class like this: class Child : public Parent { public: void Function(int param); }; void Child::Function(int param) { ;//Do nothing } When I ...

Printing the address of a struct object

I have a struct like this typedef struct _somestruct { int a; int b; }SOMESTRUCT,*LPSOMESTRUCT; I am creating an object for the struct and trying to print it's address like this int main() { LPSOMESTRUCT val = (LPSOMESTRUCT)malloc(sizeof(SOMESTRUCT)); printf("0%x\n", val); return 0; } ..and I get this warning ...

compiler warning at C++ template base class

I get a compiler warning, that I don't understand in that context, when I compile the "Child.cpp" from the following code. (Don't wonder: I stripped off my class declarations to the bare minuum, so the content will not make much sense, but you will see the problem quicker). I get the warning with VS2003 and VS2008 on the highest warning ...

Why? Implicit initialization from uninitialized parent class members

I had a nasty experience with C++ initialization, and I'm trying to see whether there is a real-world example which justifies no warnings from the compiler. The following code compiles correctly, but foo and bar get initialized with uninit values (I assume from the uninitialized parent class). The compilers, both g++ and VS, don't emit ...

How to disable VS compile warning "class or css class is not defined"

In VS 2008, when I compile, I get a large series of The class or CssClass value is not defined messages. How do I get the error/warning code (something like "C0167") for that message, so I can disable it? Answers that won't work: The compiler gives you the warning number. No, it doesn't. See the list of MSDN compiler errors (found a...

16bit bitfield leads to *read from uninitialised memory* warning

I have this typedef: typedef union { unsigned Value; unsigned Timestamp:16; } BITFIELD; and get this compiler warning: BITFIELD bitfield; // read from uninitialised memory - may result in unexpected behaviour bitfield.Timestamp = 12; Now, the warning disappears when I use a short instead of the bitfield: typedef union { ...

How to get the workaround for GCC warning, "the address of XXX will never be NULL"?

Hi, all. I'm working on C program. There is a function which takes two pointer argument and does some complex works. Let's say it as 'cmp'. cmp() is never complex for the illustrative reason. int cmp(struct foo *a, struct foo *b) { return (a->bar == b->bar); } I'd like to make a NULL-check macro, like this: #define SAFE_CMP(a,b...

Intentional compiler warnings for Visual C++ that appear in Error List?

How can you create a compiler warning (in the model of #error, except as a warning) on purpose in Visual C++ that will show up on the Error List with the correct file and line number? GCC and other compilers offer #warning, but the MSVC compiler does not. The "solution" at http://support.microsoft.com/kb/155196 does not parse in the Vi...