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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,1c1a139977eee854 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-04-20 20:59:47 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!feed2.news.rcn.net!rcn!wn14eed!wn1feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!sccrnsc01.POSTED!not-for-mail From: Wannabe h4x0r Subject: Re: Case statement and Integers. Newsgroups: comp.lang.ada References: User-Agent: Pan/0.11.1 (Unix) Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 8bit X-Comment-To: "tmoran" Message-ID: NNTP-Posting-Host: 12.245.48.122 X-Complaints-To: abuse@attbi.com X-Trace: sccrnsc01 1019361586 12.245.48.122 (Sun, 21 Apr 2002 03:59:46 GMT) NNTP-Posting-Date: Sun, 21 Apr 2002 03:59:46 GMT Organization: AT&T Broadband Date: Sun, 21 Apr 2002 03:59:47 GMT Xref: archiver1.google.com comp.lang.ada:22849 Date: 2002-04-21T03:59:47+00:00 List-Id: On Sat, 20 Apr 2002 14:31:04 -0400, tmoran wrote: > The items after the "when" must be constant values of "numbers(j)". > This code has dynamic boolean expressions. "case" is not just another > syntax for "if then". When the compiler sees a "case" statement it > should, at least conceptually if not in implementation, be able to > create a jump table indexed by the value of "numbers(j)". It clearly > can't do that here. > If you had a comparison function > type Compare_Results is (LT, EQ, GT); function Compare(Left, Right : > Numbers_Type) return Compare_Results; > then you could say > case Compare(numbers(j), pivot) is > when LT => > when GT => > when EQ => > end case; > because the compiler could create a three-entry jump table. > This technique works but ... >> Using an if..else statement wouldn't be original. > Bicycling to Hawaii is original - but it won't work either. In > Software Engineering, the point is to make something that works, not > necessarily something original. In fact, since you will abandon most of > your code to your maintenance successors (one hopes you move on to new > things!), and originality will just confuse them, originality itself is > a downright *negative* aspect of code, to be used only when the negative > is outweighed by the positive benefits of the novel technique. ... your point is well taken. I suppose I do have a tendency to go overboard. I'll keep your technique in mind, but will for the time being defer to the if...then...else method of doing the sort. Thanks Chris