[Prev][Next][Index]

Re: Bug during installation



> pcxx_merge.c: In function `get_next_rec':
> pcxx_merge.c:78: warning: passing arg 2 of `read' from incompatible pointer type
>  
> while doing "make install" on version 1.7 of pC++.  I believe the error
> is occurring because you call "read" with a pointer to a struct as its
> second argument, when in reality "read" requires a pointer to a char as its
> second argument.
>  
> Is this just an oversensitivity in my compiler, or is some other version
> of "read" supposed to be present in my system that can take pointers to
> structs in lieu of pointers to chars?

No, everything is fine. "read" is supposed to take a "generic" pointer
to a buffer. In ANSI C this is "void *" and this pointer type is "compatible"
with all other pointer types. In older pre-ANSI C (for which your system's
include files are probably still written) there was no "void *" and "char *"
was used instead.

If you want to get rid of the warning insert a cast to a char pointer "(char *)"
before the 2nd argument;

Bernd

-- 
Bernd Mohr   --   mohr@cs.uoregon.edu   --  http://www.cs.uoregon.edu/~mohr

Sometimes I think the surest sign that intelligent life exists elsewhere in
the universe is that none of it has tried to contact us.          -- Calvin


Reference(s):