comp.lang.ada
 help / color / mirror / Atom feed
From: "David C. Hoos" <david.c.hoos.sr@ada95.com>
To: "Keith Thompson" <kst-u@mib.org>
Cc: "comp.lang.ada@ada.eu.org" <comp.lang.ada@ada-france.org>
Subject: Re: A question re meaning/use of the "for ... use ..."
Date: Wed, 8 Dec 2004 07:48:06 -0600
Date: 2004-12-08T07:48:06-06:00	[thread overview]
Message-ID: <mailman.179.1102513844.10401.comp.lang.ada@ada-france.org> (raw)
In-Reply-To: ln8y8932ei.fsf@nuthaus.mib.org

The Unchecked_Conversion is not between the 'Pos attribute and
the representation, but rather between the enumeration type and its
representation.

All that is necessary for portability is to constrain the 'Size of both
the enumeration type, and the integer type of its representation to
have identical sizes.

----- Original Message ----- 
From: "Keith Thompson" <kst-u@mib.org>
Newsgroups: comp.lang.ada
To: <comp.lang.ada@ada-france.org>
Sent: Tuesday, December 07, 2004 9:18 PM
Subject: Re: A question re meaning/use of the "for ... use ..."


> "Randy Brukardt" <randy@rrsoftware.com> writes:
> > "Jeffrey Carter" <spam@spam.com> wrote in message
> > news:H1Hsd.1987$yr1.256@newsread3.news.pas.earthlink.net...
> >> Stephen Leake wrote:
> >>
> >> > There is no standard attribute that returns the internal
> >> > representation specified by the enumeration representation clause.
> >> > However, GNAT provides the non-standard 'Enum_Rep for this purpose.
> >>
> >> I have no problem with 'Pos returning the abstract position number, but
> >> do think something like GNAT's 'Enum_Rep should be standard, along with
> >> a conversion the other way, equivalent to 'Val ('Enum_Val?).
> >
> > The ARG discussed this long ago, and concluded that such a facility
isn't
> > needed. That's because Unchecked_Conversion provides the needed support.
> > Indeed, this is one of the few cases where the result of
> > Unchecked_Conversion is defined by the language (using it in this way
will
> > work on all Ada compilers). There was some discussion about syntax
guides
> > that prohibit the use of Unchecked_Conversion, but there is a lot of
> > discomfort about changing the language just because some people's style
> > guides are broken...
>
> How do you portably choose the target type for the Unchecked_Conversion?
>
> The 'Pos attribute returns a result of type universal_integer; there's
> no way to make an Unchecked_Conversion return a universal_integer.
>
> -- 
> Keith Thompson (The_Other_Keith) kst-u@mib.org
<http://www.ghoti.net/~kst>
> San Diego Supercomputer Center             <*>
<http://users.sdsc.edu/~kst>
> We must do something.  This is something.  Therefore, we must do this.
> _______________________________________________
> comp.lang.ada mailing list
> comp.lang.ada@ada-france.org
> http://www.ada-france.org/mailman/listinfo/comp.lang.ada
>




  reply	other threads:[~2004-12-08 13:48 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-12-05 15:27 A question re meaning/use of the "for ... use ..." Erik J Pessers
2004-12-05 15:47 ` Martin Krischik
2004-12-05 15:59 ` Stephen Leake
2004-12-05 16:52   ` Jeffrey Carter
2004-12-06 19:59     ` Randy Brukardt
2004-12-07  1:36       ` Jeffrey Carter
2004-12-07  2:40         ` David C. Hoos, Sr.
2004-12-07 20:59         ` Randy Brukardt
2004-12-08  1:41           ` Jeffrey Carter
2004-12-08  8:40           ` Martin Dowie
2004-12-08 16:23             ` Georg Bauhaus
2004-12-08  3:18       ` Keith Thompson
2004-12-08 13:48         ` David C. Hoos [this message]
2004-12-08 19:50         ` Randy Brukardt
2004-12-08 23:00           ` Keith Thompson
2004-12-09 23:06             ` Randy Brukardt
2004-12-10  2:26               ` Keith Thompson
2004-12-10 19:42                 ` Randy Brukardt
2004-12-10 21:18                   ` Keith Thompson
2004-12-11  0:53                     ` Keith Thompson
2004-12-10  3:13             ` David C. Hoos
2004-12-10  9:23               ` Keith Thompson
2004-12-10 13:24                 ` David C. Hoos
replies disabled

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