is this really an illigal combination?

Jim Klavetter jjk at astro.UMD.EDU
Mon Jan 15 17:04:58 AEST 1990


With the following declarations:

char *nam, *pstring;

I get an warning message with the following line of code:

if(NULL==(pstring=strrchr(nam, '.')) || strcmp(pstring,".imh"))

The warning from my compiler is

"imropen.c", line 17: warning: illegal combination of pointer and integer, op =

Everything works as I expect.  Furthermore, this code is analagous to
code I found in the book TOPICS IN C PROGRAMMING by Kochan and Wood.

Note that I have isolated the warning to the fragment

pstring=strrchr(f77nam, '.');

and I HAVE included <strings.h> as the manual indicates.  If I include
<string.h>, however (not indicated by the man page), I do not get the
warning message.  In <string.h> there is 

extern char *strrchr();

not in <strings.h>.  

So the real question is:  is there a bug in <strings.h> or the man
page or my code or my compiler?

I am on a sun 3/50 running 4.0.3.  E-mail replies since and I will
post if there is a definitive answer.

jjk at astro.umd.edu



More information about the Comp.lang.c mailing list