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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,fd173879a595bde X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII Path: g2news1.google.com!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!local01.nntp.dca.giganews.com!nntp.comcast.com!news.comcast.com.POSTED!not-for-mail NNTP-Posting-Date: Fri, 04 Nov 2005 17:27:52 -0600 From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Default rep specs for record types - documented?? References: X-Newsreader: Tom's custom newsreader Message-ID: Date: Fri, 04 Nov 2005 17:27:52 -0600 NNTP-Posting-Host: 24.6.102.223 X-Trace: sv3-Oug1yHqf8tqmrgpJgUGtTrAH6dkOC/Ej6GdQykRymlZ7FgS8tBvc/iTDvzYAlyHb7kjfJC35K139Tzz!Kskl5w0stl6IOyRAScEyHn40mCIm1TtN+54nbPcyCy6cOnQA+v5+q4dAQqAiGAsgeIr+Ztkwku3b!epWNKM0g+Y2WrA== X-Complaints-To: abuse@comcast.net X-DMCA-Complaints-To: dmca@comcast.net X-Abuse-and-DMCA-Info: Please be sure to forward a copy of ALL headers X-Abuse-and-DMCA-Info: Otherwise we will be unable to process your complaint properly X-Postfilter: 1.3.32 Xref: g2news1.google.com comp.lang.ada:6217 Date: 2005-11-04T17:27:52-06:00 List-Id: > The raison d'�tre behind record representation clauses is to make sure > that a record layout matches some external data format. For internal > data, you would be better off forgoing the representation clauses and > letting the compiler choose the optimal record layout. Absolutely. Alignment can make a substantial performance difference on some machines, so re-ordering or inserting padding will be an optimization. If you insert a rep spec where it really isn't needed (whether a hand or compiler or tool generated one) it may prevent valuable, and non-obvious, optimization when the program is recompiled for a different CPU. IIRC, at least one Ada compiler, given type R is record A : integer; B : integer range 40 .. 40 := 40; C : integer; end record; allocated zero bits for B since its value was known to be a constant 40. Underspecifying can be erroneous, but overspecifying can also have bad results.