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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Thread: 103376,fd173879a595bde X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news4.google.com!newshub.sdsu.edu!elnk-nf2-pas!newsfeed.earthlink.net!stamper.news.pas.earthlink.net!newsread3.news.pas.earthlink.net.POSTED!a6202946!not-for-mail From: "Jeffrey R. Carter" Organization: jrcarter at acm dot org User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.7.12) Gecko/20050915 X-Accept-Language: en-us, en MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Default rep specs for record types - documented?? References: In-Reply-To: Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Message-ID: Date: Fri, 04 Nov 2005 05:30:27 GMT NNTP-Posting-Host: 67.3.210.212 X-Complaints-To: abuse@earthlink.net X-Trace: newsread3.news.pas.earthlink.net 1131082227 67.3.210.212 (Thu, 03 Nov 2005 21:30:27 PST) NNTP-Posting-Date: Thu, 03 Nov 2005 21:30:27 PST Xref: g2news1.google.com comp.lang.ada:6175 Date: 2005-11-04T05:30:27+00:00 List-Id: Anonymous Coward wrote: > Example: Cohen states that enumerated types are guaranteed to have a > representation that numbers the first element as zero, and increases > sequentially. Is this not really guaranteed? It is guaranteed. ARM 13.4 says, "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." ARM 3.5.1 says, "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." So, this representation is specified by the language. Therefore, 13.1 doesn't apply to enumeration types. For record types, ARM 13.5.1 says, "If no component_clause is given for a component, then the choice of the storage place for the component is left to the implementation. If component_clauses are given for all components, the record_representation_clause completely specifies the representation of the type and will be obeyed exactly by the implementation." Therefore, 13.1 does apply to record types. > What's disappointing is that rep specs add considerable clutter. > Readable code avoids redundancy, so having default representation > aspects that are guaranteed enable less noisey code. I'm not looking > forward to rep specing records bit for bit simply to enforce the same > order of elements that's specified in the operation specs. If you need a specific representation for a record, you must specify it. I would do this even if I knew the compiler would choose the same layout by default; anything less is simply asking for a subtle error later. You usually only need a specific representation for types used for interfacing. -- Jeff Carter "Now go away or I shall taunt you a second time." Monty Python & the Holy Grail 07