Game Development Community

Are warnings ok when compiling?

by Michael Wojcik · in Torque Game Engine · 07/12/2005 (8:30 am) · 5 replies

I followed the TBE instructions word for word, and noticed quite a few errors while compiling.



--> Compiling game/aiPlayer.cc
game/aiPlayer.cc: In function 'S32 cAIPlayergetAimObject(AIPlayer*, int, const
char**)':
game/aiPlayer.cc:432: warning: argument of negative value '-1' to 'unsigned int
'
game/aiPlayer.cc: In member function 'S32 AIPlayer::getTargetDistance() const':
game/aiPlayer.cc:493: warning: return to 'S32' from 'float'
game/aiPlayer.cc:493: warning: argument to 'int' from 'float'


-----

--> Compiling platform/profiler.cc
platform/profiler.cc: In function 'S32 rootDataCompare(const void*, const
void*)':
platform/profiler.cc:356: warning: return to 'S32' from 'double'
platform/profiler.cc:356: warning: argument to 'int' from 'double'



are these normal? Or am I missing something?

#1
07/12/2005 (8:33 am)
There's nothing to worry about. Those are warnings, not errors. They merely are hints generated by the compiler to indicate that something is not completely according to standards, or that implicit conversions will be performed. The warnings you pasted casn be safely ignored afaik.
#2
07/12/2005 (9:19 am)
Well yes and no. Even though they are warnings, you sould try to get rid of them as they maybe causing you trouble.

for example
Quote:
game/aiPlayer.cc:432: warning: argument of negative value '-1' to 'unsigned int'

this one sounds innocent enough, but if you have code like the following

unsigned int test = -1;

if (test < 0)
  printf("Failed");
else
 printf("Success");

you will never ever see Failed being printed.

Edit: bah [bold] [/bold] does not work.. lol
#3
07/12/2005 (9:25 am)
The ones you posted (like the others said) are innocent and harmless most of the time, but you should never let warnings slip by when you can correct them. They can break your game.
#4
07/12/2005 (12:44 pm)
These were all stock error's that shipped with the base install of TGE 1.3, and TBE w/ Eclipse, so I just needed some clarification. :) Ty all for your thoughts.
#5
07/12/2005 (12:51 pm)
Another reason to get rid of even warnings you know are OK is that serious warnings can get lost in between the OK warnings.

Michael - be sure to distinguish between warnings and errors. Errors stop your program from compiling, warnings don't, even tho they may in fact be programming mistakes, they're only compiler warnings.