Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!ncar!asuvax!mcdphx!estinc!fnf From: fnf@estinc.UUCP (Fred Fish) Newsgroups: comp.lang.c Subject: Re: lint [but not really printf] Message-ID: <203@estinc.UUCP> Date: 14 Jul 89 18:48:20 GMT References: <328@tree.UUCP> <417@siswat.UUCP> <105@borabora.omni.com> Reply-To: fnf@estinc.UUCP (Fred Fish) Organization: Enhanced Software Technologies, Inc. Lines: 34 In article limes@sun.com (Greg Limes) writes: > >In article <105@borabora.omni.com> bob@omni.com (Bob Weissman) writes: > Last week I spent an entire day tracking down one of those bugs you just > don't see after staring at your code too long. It was of the form: > > if (condition); > action; > >You mean this never bit you before? Put it in your list of common >things to look for when the bugs get weird, along with confusing the I can honestly say that I have NEVER been bitten by this sort of bug in my own C code, because my style rules dictate that it be written as: if (condition) { action; } and it would never occur to my fingers to stick a ';' in place of the '{'. Just because the {} are optional is no reason to leave them out. If you are going to leave them out, at least have the decency to write it as: if (condition) action; (Sorry about the obvious, but this is my pet peeve #1 about other people's code...) -Fred -- # Fred Fish, 1835 E. Belmont Drive, Tempe, AZ 85284, USA # 1-602-491-0048 asuvax!{nud,mcdphx}!estinc!fnf