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,FREEMAIL_FROM autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,71c41b6f4d72158c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-07-16 12:26:40 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!postnews1.google.com!not-for-mail From: gautier_niouzes@hotmail.com (Gautier) Newsgroups: comp.lang.ada Subject: Re: if X in 1..35000 versus Boolean Date: 16 Jul 2002 12:24:27 -0700 Organization: http://groups.google.com/ Message-ID: <17cd177c.0207161124.591d32d6@posting.google.com> References: NNTP-Posting-Host: 217.162.208.227 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8bit X-Trace: posting.google.com 1026847467 18197 127.0.0.1 (16 Jul 2002 19:24:27 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: 16 Jul 2002 19:24:27 GMT Xref: archiver1.google.com comp.lang.ada:27158 Date: 2002-07-16T19:24:27+00:00 List-Id: Keith Thompson: > If I recall correctly (it's been a while), in Pascal you can write > something like: > > if X in [1 .. 4] then (* This is Pascal, not Ada *) > begin > ...; > end; > > where [1 .. 4] is a set value constructor. A naive Pascal compiler > would build a set value with bits 1, 2, 3, and 4 set, and all other > bits cleared, and test whether bit X is set. A more clever Pascal > compiler might generate code equivalent to X >= 1 and X <= 4. BTW what "all other bits" means is undefined in Pascal set expression. Of course it is not the full integer range, otherwise a set value with integers would be a quite huge object... In fact Turbo Pascal 6 (1990) or Delphi 6 (2001) seem to limit the values in sets to 0..255. if X in [1 .. 4, 254 .. 255] then ; passes compilation, if X in [1 .. 4, 254 .. 256] then ; or if X in [-1 .. 4] then ; doesn't! ________________________________________________________ Gautier -- http://www.mysunrise.ch/users/gdm/gsoft.htm NB: For a direct answer, address on the Web site!