Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!wuarchive!psuvax1!rutgers!mcnc!duke!jit From: jit@slic.cellbio.duke.edu (Jit Keong Tan) Newsgroups: comp.sys.sgi Subject: Re: Calling all C-men Again (typecast) Message-ID: <22176@duke.cs.duke.edu> Date: 14 Apr 91 03:25:06 GMT References: <9104131716.AA09142@karron.med.nyu.edu> Sender: news@duke.cs.duke.edu Reply-To: jit@slic.cellbio.duke.edu Organization: Duke University Medical Center, Dept. of Cell Biology Lines: 42 Nntp-Posting-Host: slic.cellbio.duke.edu Originator: jit@slic.cellbio.duke.edu In article <9104131716.AA09142@karron.med.nyu.edu> >Here is what the compiler says: >karron:~/D.Bug:47make Bug > cc -g2 Bug.c -lmalloc -o Bug > ccom: Warning: Bug.c, line 38: Illegal pointer combination: pointer to array of > float versus pointer to float > point_list[0]= p->PointPointer->Vertex; > --------------------------------------^ > ccom: Warning: Bug.c, line 59: illegal array size combination > plane_list[0]=p->LinePointer->PlaneNormals; > ------------------------------------------^ Usually if the compiler complains and that when I know I am right (needless to say this is very important) I just typecast them. It seems that your code is fine. This should be a bug in the compiler. Typecast the following to the lines that complains should keep the compiler happy. point_list[0]= (float (*)[3])p->PointPointer->Vertex; plane_list[0]=(float (*)[2][3])p->LinePointer->PlaneNormals; To avoid too many keystroke repetition, or any typing error, or to improve readability, (or to help my deficiencies about the above skills) I usually do the following: typedef float somename[2][3]; somename **plane_list; is probably easier to read than: float (**plane_list)[2][3]; -- -------------------------------------------------------- Jit Keong Tan | internet: jit@slic.cellbio.duke.edu (919) 684-8098 | bitnet : tan00001@dukemc.bitnet