How do I resolve this warning

Rupert Wood me@rupey.net
Thu Jun 19 07:10:00 GMT 2008


smac5 wrote:

> ACME.c:227: warning: assignment makes integer from pointer without a
> cast

It's more or less what the warning says: you're storing the result of strstr() in an int whereas strstr() actually returns char*s. You only test the values you store in the ints against 0.

You should change the declaration of Tmmp1 and Tmmp2 to char* or const char*. That's probably enough, although I'd also change the tests

    if (Tmmp1 == 0)

to 

    if (Tmmp1 == NULL)

too - but that's probably just style not correctness; I think the first form's actually valid too.

Hope that helps!
Rup.



More information about the Gcc-help mailing list