View Single Post
Re: Bug-NUM_FOR_EDICT Error: Bad Pointer
Old
  (#50)
Pierre-Marie Baty
Roi de France
 
Pierre-Marie Baty's Avatar
 
Status: Offline
Posts: 5,049
Join Date: Nov 2003
Location: 46°43'60N 0°43'0W 0.187A
Default Re: Bug-NUM_FOR_EDICT Error: Bad Pointer - 14-05-2004

@KaszpiR: no, but if you do

if (condition)
a / b;

the result of a / b isn't fed into any variable, hence the computation is intrinsically useless for the program, hence the if condition is useless too. And I wouldn't be surprised that any decent optimizer just drops it from the code.

@Splo:
change
inline int ENTINDEX(edict_t *pEdict) { if (STRING (pEdict->v.classname)[0] == 0); return (*g_engfuncs.pfnIndexOfEdict)(pEdict); }
to
inline int ENTINDEX(edict_t *pEdict) { if (STRING (pEdict->v.classname)[0] == 0) blah=1/bleh(); return (*g_engfuncs.pfnIndexOfEdict)(pEdict); }

And since 0 divided by anything oughta be 0, I'm not sure the optimizer doesn't even execute this:
if (iEdictNum == 0) iEdictNum /= iEdictNum;
Same problem. MAKE SURE your code will be executed.

When you say it doesn't make it crash, the point is not to MAKE it crash or not, the point is to land into the debugger when it does (because it does crash already).



RACC home - Bots-United: beer, babies & bots (especially the latter)
"Learn to think by yourself, else others will do it for you."