comp.lang.ada
 help / color / mirror / Atom feed
From: "James S. Rogers" <jimmaureenrogers@worldnet.att.net>
Subject: Unexpected language detail
Date: 1998/11/26
Date: 1998-11-26T00:00:00+00:00	[thread overview]
Message-ID: <73iqh9$3kl@bgtnsc01.worldnet.att.net> (raw)

At work we were designing a generic bounded queue package
indexed by a modular type.  One of our requirements for this queue
package is that it be able to correctly work with any modular type
as the index.

We encountered a problem when the queue contained a single
element.  This condition occurs when someone instantiates the
package with a type defined as

type Index is mod 1;

Of course, the only valid value in this type is 0.  The iterator for a
queue with this type cannot use arithmetic.  You cannot add 1 to
the current value to get 0 because 1 is out of the range of the type.

The solution we found was to use the 'SUCC attribute for the index
type.  This produced a correct iterator for all possible modular index
types.

Jim Rogers
Colorado Springs, Colorado






                 reply	other threads:[~1998-11-26  0:00 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed
replies disabled

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