Forum

Why Quake trats negative vectors as FALSE?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Why Quake trats negative vectors as FALSE?

Postby daemonicky » Wed May 04, 2011 10:43 pm

Maybe a silly question, but '0 -1 0' is FALSE when i compare it with "if". Is there some reason why? I wonder whether this operation is undefined ...
User avatar
daemonicky
 
Posts: 185
Joined: Wed Apr 13, 2011 1:34 pm

Postby Spike » Wed May 04, 2011 11:30 pm

if (somevector)
{
}
I assume?
expands to IFNOT somevector_x, $numberofinstructionsinthebraces

IFNOT tests the variable as an int. not as a vector, so only tests the first against binary 0, rather than float 0 or anything fashionable like that.
Spike
 
Posts: 2892
Joined: Fri Nov 05, 2004 3:12 am
Location: UK

Postby daemonicky » Wed May 04, 2011 11:34 pm

Yes. That is what I ment. Thank you. :)
User avatar
daemonicky
 
Posts: 185
Joined: Wed Apr 13, 2011 1:34 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest