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-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,cc9d51d301f523ef X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-12-16 16:35:36 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!sn-xit-03!sn-xit-06!sn-post-01!supernews.com!corp.supernews.com!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Newbee question Date: Mon, 16 Dec 2002 18:31:22 -0600 Organization: Posted via Supernews, http://www.supernews.com Message-ID: References: <3DFB9067.2040600@acm.org> <0dRK9.37601$xH3.400905@weber.videotron.net> <2bTK9.62545$hK4.5163007@bgtnsc05-news.ops.worldnet.att.net> <3dfdab08.5187148@news.demon.co.uk> X-Newsreader: Microsoft Outlook Express 4.72.3612.1700 X-MimeOLE: Produced By Microsoft MimeOLE V4.72.3719.2500 X-Complaints-To: abuse@supernews.com Xref: archiver1.google.com comp.lang.ada:31929 Date: 2002-12-16T18:31:22-06:00 List-Id: Marin David Condic wrote in message ... >Yes, but when the compiler rejects valid representation clauses simply >because it doesn't want to do it that way, you're back to picking the bits >apart out of a byte array just like you would with C or C++. If Ada compilers had to support every possible representation clause, I think it is likely that there wouldn't be any Ada compilers. It is probably possible to handle every possible bit alignment of every possible object, but the resulting compiler would be very complex (with that many more bugs) and/or the results code would be very inefficient. You can't have everything. >Or if the language doesn't give you a means of expressing a representation for some of >the features (How do you control where the tag goes in a tagged record so >you can effectively control the placement of everything else?) you're stuck once again. You don't NEED to control where the tag goes. You simply need to be able to control where everything else goes. Admittedly, some compilers don't allow moving the tag, but I know that Janus/Ada does and I believe that Rational Apex does as well. (In practice, it doesn't help much, because virtually all useful O-O types are controlled, meaning all user types are extensions, and you can only change the representation of the extension part of an extension. Without this rule, you can't have classwide dispatching -- obviously the tag has to be in the same place in any possible object.) >Ada has some really nice syntax for controlling representation - but all of >that is totally useless the instant the compiler starts rejecting it for even *some* of the cases. I strongly disagree. Janus/Ada has rather restrictive limits on alignment of composite objects (more than GNAT's), yet we were able to use rep. clauses on virtually all of the types imported from Windows in Claw. In the few cases where we weren't able to use them directly, we used solutions like the ones proposed as solutions to the original poster's question. And, I certainly fail to see how anyone is worse off with these solutions available than they would be in C. So, people are usually better off than C/C++ for controlling representation, and occassionally have the same amount of pain. Randy Brukardt.