From: Robert A Duff <bobduff@world.std.com>
Subject: Re: null range from 1 element discrete type
Date: 1999/11/22
Date: 1999-11-22T00:00:00+00:00 [thread overview]
Message-ID: <wcciu2uxy1i.fsf@world.std.com> (raw)
In-Reply-To: 3835D5A0.F906D31D@mitre.org
"Robert I. Eachus" <eachus@mitre.org> writes:
> Technically there is no "perfect" solution, as the compiler is
> allowed to choose a size of zero bits for such a type.
The compiler is *required* to choose 'Size = 0, and of course that's the
natural thing for the compiler to do -- anything else would require a
special case in the compiler.
But I don't see what 'Size has to do with the issue.
>...But if the
> (sub)type is a generic formal type, you shouldn't have to worry about
> this possibility.
>
> Since you always want a null range try: T'Val(1) .. T'Val(0) Since
> 'Val returns the base type of T, as long as the base type of T contains
> at least one bit you are safe.
T'Val(1) will raise Constraint_Error if T is an enum type with only one
value. The number of bits allocated for objects of type T has nothing
to do with this.
- Bob
prev parent reply other threads:[~1999-11-22 0:00 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-11-19 0:00 null range from 1 element discrete type Duncan Sands
1999-11-19 0:00 ` Matthew Heaney
1999-11-19 0:00 ` Robert Dewar
1999-11-19 0:00 ` Robert I. Eachus
1999-11-22 0:00 ` Robert Dewar
1999-11-25 0:00 ` Niklas Holsti
1999-11-22 0:00 ` Robert Dewar
1999-11-22 0:00 ` Robert A Duff [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox