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=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,c6ca9cbe17b867c4 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news1.google.com!news.glorb.com!news2.telebyte.nl!npeer.de.kpn-eurorings.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!newsmm00.sul.t-online.de!t-online.de!news.t-online.com!not-for-mail From: Martin Krischik Newsgroups: comp.lang.ada Subject: Re: access & address Date: Mon, 18 Oct 2004 09:42:55 +0200 Organization: AdaCL Message-ID: <3745545.LcIikkfZl2@linux1.krischik.com> References: <1c2f5137.0410140105.66fdb23e@posting.google.com> <1347924.5V7QhTSfdI@linux1.krischik.com> <2t7jm8F1sp752U1@uni-berlin.de> <1982479.VT7X1MC7VE@linux1.krischik.com> <0hSbd.106246$dP1.397440@newsc.telia.net> Reply-To: krischik@users.sourceforge.net Mime-Version: 1.0 Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: 8Bit X-Trace: news.t-online.com 1098086886 03 18187 FMiqXShvgi0cFgI 041018 08:08:06 X-Complaints-To: usenet-abuse@t-online.de X-ID: ZY6xr6ZBYe2boxlanaAs5Qik80a7WonAU4KPlsfPfTPqYYfqXn2XrZ User-Agent: KNode/0.8.0 Xref: g2news1.google.com comp.lang.ada:5388 Date: 2004-10-18T09:42:55+02:00 List-Id: Bj�rn Persson wrote: > Xenos wrote: > >> 0 was a type-o > > I thought it might be, but so many programmers like to count everything > from zero so I couldn't be sure. And the enumeration would have had a > valid value represented as 0 anyway, just like it would have had a valid > value represented as 15, wouldn't it? > >> My point was >> that just specifying the upper bound is good enough to guarantee the >> language internally uses an integer type with a big enough range to >> accomodate you. > > So by "close enough" you meant "enough bits to be able to represent all > values from 1 to 12"? Then I misunderstood you. It looked like you meant > "close enough to actually enforcing the restriction that only values > from 1 to 12 are valid". Well, he was referring to my Ada::Range<> template. And in thar respect it is enough to have all values between 1 .. 12. Once the enum is used to instantiate my template as in Ada::Range then 1 .. 12 would indeed be enforced as well. And, praise where praise is due: xenos enum trick for creating strongly typed integers in C++ is indeed best I have seen until now. Only now the C/C++ enum has tree different jobs to do - For my taste a bit overburdened for one language construct. With Regards Martin -- mailto://krischik@users.sourceforge.net http://www.ada.krischik.com