From owner-freebsd-chat Fri Feb 23 16:25:24 2001 Delivered-To: freebsd-chat@freebsd.org Received: from riker.skynet.be (riker.skynet.be [195.238.3.132]) by hub.freebsd.org (Postfix) with ESMTP id 3624637B4EC for ; Fri, 23 Feb 2001 16:25:10 -0800 (PST) (envelope-from brad.knowles@skynet.be) Received: from [10.0.1.2] (dialup1852.brussels.skynet.be [194.78.235.60] (may be forged)) by riker.skynet.be (8.11.2/8.11.2/Skynet-OUT-2.10) with ESMTP id f1O0N9q21168; Sat, 24 Feb 2001 01:23:09 +0100 (MET) (envelope-from ) Mime-Version: 1.0 X-Sender: bs663385@pop.skynet.be Message-Id: In-Reply-To: <20010223143019.E32113@peorth.iteration.net> References: <20010223180321.A33329@dogma.freebsd-uk.eu.org> <20010223143019.E32113@peorth.iteration.net> Date: Sat, 24 Feb 2001 01:21:28 +0100 To: "Michael C . Wu" , j mckitrick From: Brad Knowles Subject: Re: bad programming practice? Cc: freebsd-chat@FreeBSD.ORG Content-Type: text/plain; charset="us-ascii" ; format="flowed" Sender: owner-freebsd-chat@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.org At 2:30 PM -0600 2/23/01, Michael C . Wu wrote: > When you have a very lengthy boolean expression, it causes > headaches to read the code. However, I do teach new students > of C or C++ to use the if (CONST == var) formatting just so that > they do not mess up. Then I explain to them why it is a bad idea > when they advance into a better programmer. This may be an Urban Legend, but I understand that even Einstein divided by zero, by mistake. IMO, anything like this that can help me catch stupid mistakes (regardless of how many warnings may or may not be turned on), is a good thing -- even if I do learn to outgrow the technique at a later time. It would certainly help me if more people were paranoid as possible and did things like this -- I can't tell you how many times I've tried to compile something where there was an elementary error of this sort which would have been caught by better programming techniques. The truly sad thing is that many times it is much harder to find things like this because many programmers are so sloppy, or compilers are so different on so many machines, that most programs I end up building from source either generate a lot of warnings and the attitude is that this is okay, or the build scripts explicitly turn off all warnings because the programmers don't want to hear about it. -- ====================================================================== Brad Knowles, To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-chat" in the body of the message