From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6faab3246196bedc X-Google-Attributes: gid103376,public From: "Steve Folly" Subject: Re: How To Write Unmaintainable Code Date: 1999/11/21 Message-ID: <943200077.19962.0.nnrp-11.c2de848f@news.demon.co.uk>#1/1 X-Deja-AN: 551280231 X-NNTP-Posting-Host: follysplace.demon.co.uk:194.222.132.143 References: <814jiq$d8l$1@nnrp1.deja.com> X-Priority: 3 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 X-Complaints-To: abuse@demon.net X-Trace: news.demon.co.uk 943200077 nnrp-11:19962 NO-IDENT follysplace.demon.co.uk:194.222.132.143 X-MSMail-Priority: Normal Newsgroups: comp.lang.ada Date: 1999-11-21T00:00:00+00:00 List-Id: Joe Wisniewski wrote in message news:s3e4likc3ef78@corp.supernews.com... > Using function renames, change the meaning of "+" to > "-" and vice versa, etc. (OUCH) > I had the honour of helping someone debug their OWN software recently: A 'priority' type had been created from an integer with a specific range. The meaning of this type was such that a lower number meant a higher priority. Now, the "<" and ">" functions had been overloaded (can you see where I'm going....) to reverse their meaning. The author of this software explained that by doing "x > y" means that x is of a greater priority than y, and since a low number meant higher priority, the function ">" return the result of a "<" and ">" returned the result of a "<". There was an if statement in part of the code I looked at which should have been executed, but wasn't. So I was looking in the debugger and asking it to evaluate this particular "x > y" expression. The debugger does not take into account overloaded functions, yet the person I was helping assured me the functions were not overloaded. Upon searching the code we found those overloaded definitions, which he had forgotten about because they were written so long ago. After a couple of hours wasted and slap round the head :-) I think he learnt his lesson. I learnt my lesson as well - don't take anything for granted about someone's software - always find out for yourself !! -- Regards, Steve Folly. http://www.follysplace.demon.co.uk donationsto:myaccount@mybank.co.uk "Science is, foremost, a method of interrogating reality: proposing hypotheses that seem true and then testing them -- trying, almost perversely, to negate them, elevating only the handful that survive to the status of a theory. Creationism is a doctrine, whose adherents are interested only in seeking out data that support it." George Johnson, NY Times, 15 Aug 1999