Mixing S32's and U32's
by Skylar Kelty · in Torque Game Engine Advanced · 08/23/2007 (11:57 am) · 2 replies
Hey, Im not too good with this but it seems to me that in version.cpp you have:
static const U32 csgVersionNumber
then
U32 getVersionNumber()
but then
ConsoleFunction( getVersionNumber, S32...
Is this right?
Should those U32's be S32's or that S32 a U32?
Like I said im not too great on Torque programming yet, its just a question ^^
static const U32 csgVersionNumber
then
U32 getVersionNumber()
but then
ConsoleFunction( getVersionNumber, S32...
Is this right?
Should those U32's be S32's or that S32 a U32?
Like I said im not too great on Torque programming yet, its just a question ^^
About the author
Torque 3D Owner Stephen Zepp
Many times in design, it's better to treat a value as if it is unsigned (U32), and use "zero" as meaning it hasn't been set.
However, in implementation/use of the design, it can be important to have the ability to use the sign of a return result (most commonly -1) to indicate a "negative response"--for example, if you want to check the ID of an object in the simulation, the value will always be positive if the object is in the simulation--but in use, it's very convenient to return "-1" if the object doesn't exist in the simulation. This use technique of course requires the return value to be signed (S32).