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,f7c38a023cf370dc X-Google-NewGroupId: yes X-Google-Attributes: gida07f3367d7,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!news3.google.com!feeder1.cambriumusenet.nl!feed.tweaknews.nl!193.201.147.68.MISMATCH!feeder.news-service.com!aioe.org!news.tornevall.net!news.jacob-sparre.dk!pnx.dk!jacob-sparre.dk!ada-dk.org!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Should representation clauses be complete for each bit? Date: Fri, 22 Jul 2011 19:01:32 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <73c10395-ec4f-4a02-b0fc-e35bc14424fa@e18g2000vbx.googlegroups.com> NNTP-Posting-Host: static-69-95-181-76.mad.choiceone.net X-Trace: munin.nbi.dk 1311379294 24263 69.95.181.76 (23 Jul 2011 00:01:34 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Sat, 23 Jul 2011 00:01:34 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-RFC2646: Format=Flowed; Original X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6109 Xref: g2news2.google.com comp.lang.ada:21275 Date: 2011-07-22T19:01:32-05:00 List-Id: "Robert A Duff" wrote in message news:wcczkk9ngxy.fsf@shell01.TheWorld.com... ... > By the way, I find Ada's representation clauses to be at the wrong > level of abstraction. Why can't I just write a single line of code > that means "put all the components in declaration order with no gaps > in between"? Isn't that what pragma Pack (sorry, aspect Pack) does? Even though it is horrible idea (see below)? And that's (almost) always what any record declaration means (at least in Janus/Ada). We (almost) never have gaps between (discrete) components; they always fill all of the space (typically 8 or 16 bits). You could get a gap by compiling with time optimization on and then having alternating 8 and 16 (or 32) bit components, but that's the only way. (The gap is caused by alignment concerns). If you mean bit packing, I would object strenously. Bit packing *should* be hard to get, since it saps so much performance from your code. A record representation clause might be a bit wordy, but it is hard enough to write that it is clear that the programmer really wants that representation. Which is fine, then we'll go through the effort of giving it to him -- but otherwise forget it. I don't think pragma Pack should *ever* do bit packing (with the possible exception of packed arrays of Boolean). It should provide the smallest *efficient* space, not some overly packed extremely expensive in code size and runtime version. I realize that is water under the dam (or is it over the bridge ;-), but I would be very against making a bad situation worse. Randy.