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: dewar@merv.cs.nyu.edu (Robert Dewar) Subject: Re: Beware: Rep spec on an enumeration type causes code explosion Date: 1997/12/06 Message-ID: #1/1 X-Deja-AN: 295784216 References: X-Complaints-To: usenet@news.nyu.edu X-Trace: news.nyu.edu 881426652 11236 (None) 128.122.140.58 Organization: New York University Newsgroups: comp.lang.ada Date: 1997-12-06T00:00:00+00:00 List-Id: Tuck said <> We found pretty early on with GNAT that a *lot* of legacy code uses these confirming representation clauses. This is not unreasonable. In Ada 83 there is no guarantee that the default representation is zero based and contiguous, and moreover the official definition of Standard contains the following: for CHARACTER use -- 128 ASCII character set without holes (0, 1, 2, 3, 4, 5, ..., 125, 126, 127); which certainly creates the impression that it is good style to add these confirming representation clauses. Indeed I would argue that it is still good style to add them in Ada 95 as a way of documenting and emphasizing that you are depending on the representation. In any case, the fact is that a lot of code *does* contain this optimization, which is why we are careful in GNAT to make the definition of "enumeration with holes" be a situation in which the representation disagrees with the pos for at least one literal, rather than the presence of an enumeration representation clause. We have found that this optimization makes a critical performance difference for more than one of our customers. Robert Dewar Ada Core Technologies