Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!mips!ultra!ted From: ted@ultra.com (Ted Schroeder) Newsgroups: comp.lang.c Subject: Re: common bugs in C programs Message-ID: <1989Dec28.200433.16824@ultra.com> Date: 28 Dec 89 20:04:33 GMT References: <7140.25959377@urchin.fidonet.org> Organization: Ultra Network Technologies Lines: 24 Bob.Stout@p6.f506.n106.z1.fidonet.org (Bob Stout) writes: >In an article of <22 Dec 89 03:33:00 GMT>, damerla@uicbert.eecs.uic.edu writes: > >I am compiling a list of syntax and logical errors I ever made while writing > >C programs. Some of these errors are very simple but hard to debug like > >typing = in place of ==. Till now I have compiled about 25 of them and any > >contributions to this list will be appreciated. >If you make it a matter of style to write conditionals as (const == var) >rather than (var == const), your compiler will flag the error for you and make >your code *much* easier to debug. Ah, but how ugly the code becomes. There are few things that are more annoying to me than to have a piece of code assert if (2 == x) return; 2 does not equal something, but something may in fact be equal to 2. Ted Schroeder ted@Ultra.com Ultra Network Technologies ...!ames!ultra!ted 101 Daggett Drive San Jose, CA 95134 408-922-0100 Disclaimer: I don't even believe what I say, why should my company?