comp.lang.ada
 help / color / mirror / Atom feed
From: Martin Krischik <krischik@users.sourceforge.net>
Subject: Re: access & address
Date: Mon, 18 Oct 2004 09:42:55 +0200
Date: 2004-10-18T09:42:55+02:00	[thread overview]
Message-ID: <3745545.LcIikkfZl2@linux1.krischik.com> (raw)
In-Reply-To: SnDcd.106581$dP1.399688@newsc.telia.net

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<Month, January, December> 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




  reply	other threads:[~2004-10-18  7:42 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-10-14  9:05 access & address Hans Van den Eynden
     [not found] ` <1347924.5V7QhTSfdI@linux1.krischik.com>
     [not found]   ` <ckm14i$erb2@cui1.lmms.lmco.com>
2004-10-14 18:09     ` Martin Krischik
2004-10-14 20:13       ` CBFalconer
2004-10-15  8:18         ` Martin Krischik
     [not found]     ` <2t7jm8F1sp752U1@uni-berlin.de>
2004-10-14 18:17       ` Martin Krischik
2004-10-14 19:52         ` Xenos
2004-10-15  8:53           ` Martin Krischik
2004-10-15 17:30             ` Xenos
2004-10-16 14:25               ` Martin Krischik
2004-10-16 15:15                 ` Rich Herrick
2004-10-15 15:46           ` Björn Persson
2004-10-15 17:09             ` Xenos
2004-10-17 23:38               ` Björn Persson
2004-10-18  7:42                 ` Martin Krischik [this message]
2004-10-14 19:37       ` Xenos
2004-10-15  8:30         ` Martin Krischik
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox