|
Re: Weird problem with if statements
Someone who's studied C++ Operator Overloading could tell you that the equals operator has similar to the following declaration:
int & operator=(int & left_hand_side, int & right_hand_side)
That is, the assignment operator returns a reference to the assigned value, allowing chaining (I think a better term) of assignments. As long as you assign a non-zero number, this statement will evaluate to TRUE. Definitely not the behavior you want....
Good for cheats, like assigning a NULL pointer within an IF statement would return FALSE, causing the block of code to be skipped. Good for experts, nightmare for beginners.
__________________
John Dong
Co-Captain, Webmaster / Programmer
Team 245 -- Rochester Adams Robotics
|