"illegal pointer combination" problem
Ray Spalding
cc100aa at prism.gatech.EDU
Thu Mar 7 01:10:53 AEST 1991
In article <63309 at eerie.acsu.Buffalo.EDU> haozhou at acsu.buffalo.edu (Hao Zhou) writes:
>In getseg(p):
> struct pcb **p; /* pointer to pcb pointer */
> *p = (struct pcb *) shmat(shmid,(char *)0,0);
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
>This is the line which gives the warning error.
In your post, you have not shown us the declaration for "shmat".
In appears that your compiler is warning you that converting the
return value type of "shmat" into a "struct pcp *" is "illegal".
Perhaps all you need is a proper declaration of "shmat" within the
scope of "getseg", e.g.: struct pcp *shmat();
(If you have no declaration of "shmat()" in scope, it will be
considered "int". Theoretically, casts of ints to pointers is
OK, though not portable [except for constant 0]. My compiler
accepts this without comment, but I think a warning would be
acceptable, too.)
--
Ray Spalding, Technical Services, Office of Information Technology
Georgia Institute of Technology, Atlanta Georgia, 30332-0715
uucp: ...!{allegra,amd,hplabs,ut-ngp}!gatech!prism!cc100aa
Internet: cc100aa at prism.gatech.edu
More information about the Comp.lang.c
mailing list