Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!noao!ncar!gatech!prism!cc100aa From: cc100aa@prism.gatech.EDU (Ray Spalding) Newsgroups: comp.lang.c Subject: Re: "illegal pointer combination" problem Message-ID: <23634@hydra.gatech.EDU> Date: 6 Mar 91 15:10:53 GMT References: <63309@eerie.acsu.Buffalo.EDU> Organization: Georgia Institute of Technology Lines: 25 In article <63309@eerie.acsu.Buffalo.EDU> haozhou@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@prism.gatech.edu