Re: dumb coding ??

From: George (greerga@DRAGON.HAM.MUOHIO.EDU)
Date: 10/30/97


On Thu, 30 Oct 1997, Edward Glamkowski wrote:

>>>An "if (x = y)" error is evil to find when you're just learning :).
>>           ^
>>I used to do a lot of the "duh" bug searching too.
>
>An interesting trick I just learned recently for this
>type of thing is that if y is a constant, put it on the
>left, so you have something like:
>  if (0 = x)
>
>which will generate an error message, where 'if (x = 0)'
>doesn't, and can be annoying to track down.

Or you just use -Wall in GCC and it'll warn you to put parenthesis around
the statement if you really want an assignment.

--
George Greer  -  Me@Null.net   | Genius may have its limitations, but stupidity
http://www.van.ml.org/~greerga | is not thus handicapped. -- Elbert Hubbard


     +------------------------------------------------------------+
     | Ensure that you have read the CircleMUD Mailing List FAQ:  |
     | http://democracy.queensu.ca/~fletcher/Circle/list-faq.html |
     +------------------------------------------------------------+



This archive was generated by hypermail 2b30 : 12/08/00 PST