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,8247c32bb1260c74 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-04-22 17:24:35 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn13feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc51.ops.asp.att.net.POSTED!not-for-mail From: tmoran@acm.org Newsgroups: comp.lang.ada Subject: Re: Q re pack & aliased References: X-Newsreader: Tom's custom newsreader Message-ID: <63lpa.48072$Si4.30616@rwcrnsc51.ops.asp.att.net> NNTP-Posting-Host: 12.234.13.56 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc51.ops.asp.att.net 1051057474 12.234.13.56 (Wed, 23 Apr 2003 00:24:34 GMT) NNTP-Posting-Date: Wed, 23 Apr 2003 00:24:34 GMT Organization: AT&T Broadband Date: Wed, 23 Apr 2003 00:24:34 GMT Xref: archiver1.google.com comp.lang.ada:36387 Date: 2003-04-23T00:24:34+00:00 List-Id: > I suggest that 'aliased' was always inappropriate anyway. > > When you are declaring an object which will overlay a piece of memory that > will correspond to some external entity (e.g. an address range corresponding > to a memory-mapped I/O facility, such as a memory-mapped graphics device), > you do not need (or want) 'aliased', you need to mark the object (or its > static subtype) as 'volatile'. This is done with the Volatile pragma, see The case at hand is a DIBitmap in Windows. It needs to be in packed, 24 bit, format so I can pass it to Windows (not to mention size considerations). I also need sometimes to make pointers to individual elements, so the components need to be aliased. There is no second task, hardware or software, accessing it, so it's not Volatile. The individual component (pixel) is rep-speced to layout the red/green/blue parts, and to say the @#$% thing is 24 bits in size. That used to be enough to convince all the compilers I tried that a pixel was in fact 24 bits. The only advantage of 'component_size over pragma pack in this case is that the former generates a fatal compilation error with Gnat 3.15, the latter, a warning and an incorrect program. (In ObjectAda, however, 'component_size does the desired thing, while pragma pack is ignored with no warning. Janus packs as desired. I'd be curious what happens with Rational or Green Hills Windows targeted compilers.)