Calling all C-men Again (typecast)

Jit Keong Tan jit at slic.cellbio.duke.edu
Sun Apr 14 13:25:06 AEST 1991


In article  <9104131716.AA09142 at 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 at slic.cellbio.duke.edu
(919) 684-8098    | bitnet  : tan00001 at dukemc.bitnet



More information about the Comp.sys.sgi mailing list