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: dmarshal@netcom.com (David Marshall) Subject: Re: Beware: Rep spec on an enumeration type causes code explosion Date: 1997/12/06 Message-ID: #1/1 X-Deja-AN: 295682368 Sender: dmarshal@netcom3.netcom.com References: Organization: Netcom On-Line Services Newsgroups: comp.lang.ada Date: 1997-12-06T00:00:00+00:00 List-Id: gwinn@res.ray.com (Joe Gwinn) writes: [interesting information on Ada95 code tuning snipped] >We have now removed the bulk of the rep specs on enumeration types, just >trusting for now that the compiler will always start enumerations at zero, >just like C/C++. Ada95 does not specify the base value of an enumeration, >so compilers vary. We were using rep specs to govern the representation of >Ada records used to generate and understand messages exchanged with >display consoles coded in C++. This idiom is used extensively. For >portability, we will eventually change the code to remove all ungoverned >enumerations. Just a moment! Ada95 DOES represent the base value of the first enumeral as zero, unless otherwise specified with an enumeration representation clause. RM95 3.5.1(7): Each enumeration literal corresponds to a distinct value of the enumeration type, and to a distinct position number. The position number of the value of the first listed enumeration literal is zero; the position number of the value of each subsequent enumeration literal is one more than that of its predecessor in the list. RM95 13.4(8): For nonboolean enumeration types, if the coding is not specified for the type, then for each value of the type, the internal code shall be equal to its position number. -- Dave Marshall dmarshal@netcom.com