From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=0.2 required=5.0 tests=BAYES_00,INVALID_MSGID, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,ca9eef4d5e2078ea X-Google-Attributes: gid103376,public From: Ken Garlington Subject: Re: Beware: Rep spec on an enumeration type causes code explosion Date: 1997/12/10 Message-ID: <348F3DFC.10DB@nospam.flash.net>#1/1 X-Deja-AN: 297078212 References: Organization: Flashnet Communications, http://www.flash.net Reply-To: Ken.Garlington@nospam.computer.org Newsgroups: comp.lang.ada Date: 1997-12-10T00:00:00+00:00 List-Id: Tucker Taft wrote: > [big snip] > I believe enumeration representation > clauses in Ada are a mistake. If a user wants to name > particular values, they should simply use named integer > constants, or perhaps better, named private-type constants. They can build > up various maps of their own if they want to translate to/from some kind > of "holey" representation from/to a contiguous representation. One of the nice things about "holey" representations in Ada, when used for interfacing to external systems, is the use of 'Valid to check for valid input data in a very readable manner. However, I would convert the raw input to a non-holey type after the check, using either a map or case statement (depending upon the compiler). > One "innocent" looking construct I once found was: > > (others => Default_Value(Segment)) > > used to initialize a segment of a load module to some default value. > This called the function Default_Value once for each byte of the > segment, and the segment was often 100K bytes or more. Assuming the function's library unit was marked Pure, then this could (and probably should) have been optimized, right? In this case, isn't this more of a compiler issue than a language issue? > -Tucker Taft stt@inmet.com http://www.inmet.com/~stt/ > Intermetrics, Inc. Burlington, MA USA