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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID 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: "Marin David Condic, 561.796.8997, M/S 731-96" Subject: Re: Beware: Rep spec on an enumeration type causes code explosion Date: 1997/12/11 Message-ID: <97121110170208@psavax.pwfl.com>#1/1 X-Deja-AN: 297245488 Sender: Ada programming language Comments: To: stt@houdini.camb.inmet.com X-VMS-To: SMTP%"INFO-ADA@VM1.NODAK.EDU" X-VMS-Cc: SMTP%"stt@HOUDINI.CAMB.INMET.COM",CONDIC Newsgroups: comp.lang.ada Date: 1997-12-11T00:00:00+00:00 List-Id: Tucker Taft writes: >language design principles. Your enumeration rep clause simply reconfirmed >the default representation, but suppose it didn't? You would be >stuck with the overhead you managed to eliminate by simply commenting >out the rep clause. Of course, the compiler could recognize various >other specials cases, such as contiguous representation starting at >something other than zero, or evenly distributed "holey" representation >(e.g., even numbers only), or simply not "too" sparse, or ... > I'll give you a good reason why getting too smart about rep clause implementation might be a Bad Thing. Suppose I implement an enumeral type with a "confirming" rep clause because I know I'm dealing with a real live hardware interface or message format and want to make it clear that the representation for this given enumeration is critical. I compile & run and my timing comes out a given way because your compiler was smart enough to detect that my representation was conveniently matching the positions. So far, so good. At a later date the hardware or message format changes to include some new bit patterns which create holes in the representation and now when I compile I get a significantly different implementation for the enumeration and a corresponding change in performance. This is a satisfactory definition of the technical term: "Bad Thing". Sometimes poor performance isn't as bad a Bad Thing as inconsistent performance can be. MDC Marin David Condic, Senior Computer Engineer Voice: 561.796.8997 Pratt & Whitney GESP, M/S 731-96, P.O.B. 109600 Fax: 561.796.4669 West Palm Beach, FL, 33410-9600 Internet: CONDICMA@PWFL.COM =============================================================================== Glendower: "I can call spirits from the vasty deep." Hotspur: "Why so can I, or so can any man; but will they come when you do call for them?" -- Shakespeare, "Henry IV" ===============================================================================