[Bf-committers] Radio code!
Ton Roosendaal
ton at blender.org
Sun Dec 10 23:16:02 CET 2006
Hi Brecht,
Someone pointed me at warnings in radpostprocess.c (gcc 3.3 doesnt
here):
gcc error:
"radpostprocess.c:760: warning: dereferencing type-punned pointer will
break strict-aliasing rules"
It is stuffed with lines like:
mcol[0]= *((unsigned int*)face->v1+3) | 0x1000000;
*((unsigned int*)face->v1+3)= ~0;
unsigned int *col= ((unsigned int**)&face->v1)[i] + 3;
*vco= ((float**)&face->v1)[i];
((unsigned int*)&mf->v1)[i] = *col;
subco= (me->mvert + ((unsigned int*)&mf->v1)[i])->co;
Which might seem incredible smart (I am too stupid to grasp this code),
but it smells like very dangerous hacking, bypassing the meaning of
structs.
If you don't like MCol or MFace structures, then make own temporal
structs to store things in, with proper names and no casting. Or use
your custom data storage...
Or am I wrong? For me, this I can never fix or check if it's 64 bits
safe code for example...
-Ton-
------------------------------------------------------------------------
--
Ton Roosendaal Blender Foundation ton at blender.org
http://www.blender.org
More information about the Bf-committers
mailing list