comp.lang.ada
 help / color / mirror / Atom feed
From: Ken Garlington <kennieg@nospam.flash.net>
Subject: Re: Beware: Rep spec on an enumeration type causes code explosion
Date: 1997/12/17
Date: 1997-12-17T00:00:00+00:00	[thread overview]
Message-ID: <34989854.682D@nospam.flash.net> (raw)
In-Reply-To: 3496C3E0.6DA06C0E@ac3i.dseg.ti.com


John G. Volan wrote:
> 
> Ken Garlington wrote:
> 
> > A response to this statement was: "There is no need for anything so
> > elaborate." The corresponding code did the conversion without a
> > check, which prompted me to ask how validity was handled.
> 
> Sorry, let me clarify: I wasn't commenting on the need to use 'Valid, of
> course that is quite necessary. What I was getting at was that you
> seemed to imply that the "holey" type ought to be something other than
> an enumeration type, let's say an integer type;

No, I was assuming a conversion between a holey to non-holey enumeration
type;

> and that the programmer
> should write some elaborate function involving perhaps a case statement
> to do a mapping between valid integer values and the target enumeration
> type.  

Maybe (although it shouldn't be that elaborate). I have seen cases where
using a case statement is slightly more efficient than using the
built-in
type conversion (as well as the opposite). Given the expected use to
convert
I/O, small optimizations in this area can be important. Of course, the
choice is compiler dependent.

> All I was trying to show was that Ada's built-in type conversion
> facility can "automagically" supply this mapping, if you simply derive a
> "holey" enumeration type from a parent "contiguous" enumeration type.
> 
> --
> ------------------------------------------------------------------------
> Internet.Usenet.Put_Signature
>   (Name       => "John G. Volan",
>    Employer   => "Raytheon/TI Advanced C3I Systems, San Jose, CA",
>    Work_Email => "jvolan@ti.com",
>    Home_Email => "johnvolan@sprintmail.com",
>    Slogan     => "Ada95: World's *FIRST* International-Standard OOPL",
>    Disclaimer => "My employer never defined these opinions, so using " &
>                  "them would be totally erroneous...or is that just "  &
>                  "nondeterministic behavior now? :-) ");
> ------------------------------------------------------------------------




  reply	other threads:[~1997-12-17  0:00 UTC|newest]

Thread overview: 70+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1997-12-05  0:00 Beware: Rep spec on an enumeration type causes code explosion Joe Gwinn
1997-12-06  0:00 ` Robert Dewar
1997-12-08  0:00   ` Joe Gwinn
1997-12-09  0:00     ` Stanley R. Allen
1997-12-06  0:00 ` Robert Dewar
1997-12-06  0:00 ` Corey Minyard
1997-12-08  0:00   ` Joe Gwinn
1997-12-10  0:00     ` Robert Dewar
1997-12-06  0:00 ` Ken Garlington
1997-12-06  0:00 ` Tucker Taft
1997-12-06  0:00   ` Robert Dewar
1997-12-06  0:00   ` Robert Dewar
1997-12-08  0:00   ` Joe Gwinn
1997-12-08  0:00     ` Mats Weber
1997-12-09  0:00     ` Tucker Taft
1997-12-09  0:00       ` Matthew Heaney
1997-12-10  0:00         ` Charles Hixson
1997-12-10  0:00       ` Jean-Pierre Rosen
1997-12-10  0:00       ` Robert Dewar
1997-12-10  0:00       ` Stephen Leake
1997-12-14  0:00         ` Robert Dewar
1997-12-10  0:00       ` Stanley R. Allen
1997-12-14  0:00         ` Robert Dewar
1997-12-10  0:00       ` Ken Garlington
1997-12-11  0:00         ` John G. Volan
1997-12-11  0:00           ` Ken Garlington
1997-12-12  0:00             ` Matthew Heaney
1997-12-12  0:00               ` Ken Garlington
1997-12-16  0:00                 ` John G. Volan
1997-12-17  0:00                   ` Ken Garlington [this message]
1997-12-12  0:00           ` Joe Gwinn
1997-12-12  0:00             ` Robert Dewar
1997-12-16  0:00             ` John G. Volan
1997-12-17  0:00               ` Joe Gwinn
1997-12-17  0:00                 ` John G. Volan
1997-12-18  0:00                   ` Joe Gwinn
1997-12-17  0:00               ` Ken Garlington
1997-12-12  0:00           ` Alan E & Carmel J Brain
1997-12-12  0:00             ` Robert Dewar
1997-12-15  0:00               ` Tucker Taft
1997-12-16  0:00                 ` Brian Rogoff
1997-12-11  0:00       ` Rakesh Malhotra
1997-12-11  0:00         ` Matthew Heaney
1997-12-12  0:00           ` Samuel Tardieu
1997-12-12  0:00             ` Robert Dewar
1997-12-12  0:00           ` Rakesh Malhotra
1997-12-12  0:00           ` Robert Dewar
1997-12-14  0:00         ` Alan E & Carmel J Brain
1997-12-12  0:00       ` Joe Gwinn
1997-12-15  0:00         ` Robert Dewar
1997-12-16  0:00           ` Joe Gwinn
1997-12-16  0:00             ` Robert Dewar
1997-12-09  0:00     ` Geert Bosch
1997-12-10  0:00       ` Robert Dewar
1997-12-06  0:00 ` Kevin D. Heatwole
     [not found]   ` <dewar.881478386@merv>
1997-12-07  0:00     ` Robert Dewar
1997-12-09  0:00   ` Jim Gleason
1997-12-06  0:00 ` David Marshall
1997-12-06  0:00 ` Robert Dewar
1997-12-06  0:00   ` Matthew Heaney
1997-12-10  0:00   ` GNORT information ( Was Re: Beware: Rep spec on an enumeration type causes code explosion ) Mark Bennison
1997-12-10  0:00     ` Robert Dewar
1997-12-06  0:00 ` Beware: Rep spec on an enumeration type causes code explosion Robert Dewar
1997-12-08  0:00   ` Joe Gwinn
1997-12-06  0:00 ` Robert Dewar
1997-12-07  0:00 ` Larry Kilgallen
  -- strict thread matches above, loose matches on Subject: below --
1997-12-09  0:00 tmoran
1997-12-11  0:00 Marin David Condic, 561.796.8997, M/S 731-96
1997-12-11  0:00 ` Robert Dewar
1997-12-11  0:00 Marin David Condic, 561.796.8997, M/S 731-96
replies disabled

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