[coreboot] C Programming

Peter Stuge peter at stuge.se
Mon Jul 14 11:46:09 CEST 2008


On Mon, Jul 14, 2008 at 06:16:06AM +0800, Star Liu wrote:
> I hope I'm not posting to the wrong place, if so, please remind me :)
> I'm making some practice on C programming, so that I can get into the
> linux world.

Well it seems you're programming a CGI application, so I think this
list isn't the best place to ask.


> 131	if(strcasestr(comment, "</xmp")!=NULL)
..
> LeaveMessage.c:131: warning: comparison between pointer and integer
..

> So i don't know why i got this warning,

The error says that something is wrong in the comparison. You're
comparing a function return value with NULL.

Either the compiler believes that strcasestr() returns integer, or it
believes that NULL is defined as integer.

The latter is not so likely because NULL is usually defined as (void *)
which is a pointer type, or it is not defined at all. If it was not
defined at all, you would get a different error message.

So, the compiler says strcasestr() returns integer. That is the
fallback if the compiler has not seen a prototype (or declaration)
for a function before it is called.


> what's the correct way to deal with it?

I think you may be missing

#include <strings.h>

where strcasecmp() is declared.


//Peter




More information about the coreboot mailing list