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,d2cba5965c7bfcd5 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-03-05 11:12:33 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!msc1.onvoy!ply1.onvoy!upp1.onvoy!onvoy.com!news-out.visi.com!hermes.visi.com!nnxp1.twtelecom.net!news-east.rr.com!news-west.rr.com!news.airnews.net!cabal10.airnews.net!cabal1.airnews.net!news-f.iadfw.net!usenet From: "John R. Strohm" Newsgroups: comp.lang.ada Subject: Re: 64bit access to an array of 8bit values Date: Tue, 5 Mar 2002 12:49:25 -0800 Organization: Airnews.net! at Internet America Message-ID: <01D3EF1F744692CE.E4285A1E194C94B7.800ACE8F1D3EC3C7@lp.airnews.net> X-Orig-Message-ID: References: <3C823A1A.6030006@users.sf.net> <0CFB5EECF8614F8D.52C8F36A468D2F14.3AD3D533D2B72FDB@lp.airnews.net> Abuse-Reports-To: abuse at airmail.net to report improper postings NNTP-Proxy-Relay: library2.airnews.net NNTP-Posting-Time: Tue Mar 5 13:11:32 2002 NNTP-Posting-Host: !b!H%1k-XKTjG%\ (Encoded at Airnews!) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:20819 Date: 2002-03-05T12:49:25-08:00 List-Id: "Jeffrey Creem" wrote in message news:s2tg8.43726$%b6.11496771@typhoon.ne.ipsvc.net... > > "John R. Strohm" wrote in message > news:0CFB5EECF8614F8D.52C8F36A468D2F14.3AD3D533D2B72FDB@lp.airnews.net... > > The short answer is that you can't do what you want to do. > > > The longer answer is that it is this abstract philosophical academic mindset > that convinces > people that nothing can be done in Ada. In fact you can do what you want to > do. > > There are several "as portable as C or better" approches that could be taken > to solve this problem > (involving rep spec and either unchecked conversion of access types or array > slices) that > will solve this problem just fine. Some of these would probably break on > some compiler with > lack of full annex support or strange word sizes..But most of the time it > would be fine. The key phrase in there is "most of the time". I've spent too many years fixing something that should have worked "most of the time" because I happened to stumble into the part of the time where it DIDN'T. The one that I remember was a rep spec for an 8-bit device control register, on a 32-bit machine. The LRM requires the compiler to preserve the other 32 bits, which means that every write of the device control register was also generating a read, to get the 24 bits that I apparently wasn't planning on changing so they could be pasted back in. Unfortunately, it was rather crucial that the register NOT be read at that particular moment. What this taught me is that solutions that work "most of the time" DON'T work ALL of the time, and the right answer is never be satisfied with something that doesn't work ALL of the time. Correctness is a binary property.