View Single Post
  #12   Spotlight this post!  
Unread 06-02-2006, 08:27
tpc's Avatar
tpc tpc is offline
Registered User
AKA: Tom Convery
FRC #0623 (Cougar Robotics)
Team Role: Mentor
 
Join Date: Feb 2006
Rookie Year: 2006
Location: Falls Church, VA
Posts: 7
tpc is on a distinguished road
Re: Stupidest Programming Mistakes

Quote:
Originally Posted by chakorules
Burns me ALL this time....don't forget to use DOUBLE equal signs....
This is why I always write the constant first, when comparing equality between a constant and a variable:

Code:
if (1 == variable)
{
  /* do something */
}
Then if I inadvertently use an assignment rather than a comparison, it's a compile-time error (can't assign a value to a constant).