comp.lang.ada
 help / color / mirror / Atom feed
From: tmoran@acm.org
Subject: Re: Q re pack & aliased
Date: Wed, 23 Apr 2003 00:24:34 GMT
Date: 2003-04-23T00:24:34+00:00	[thread overview]
Message-ID: <63lpa.48072$Si4.30616@rwcrnsc51.ops.asp.att.net> (raw)
In-Reply-To: b84i4t$6ajfe$1@ID-25716.news.dfncis.de

> 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.)



  reply	other threads:[~2003-04-23  0:24 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-04-20  1:08 Q re pack & aliased tmoran
2003-04-20 11:40 ` David Holm
2003-04-21  4:44   ` tmoran
2003-04-22 16:08     ` Jacob Sparre Andersen
2003-04-22 16:30       ` Vinzent Hoefler
2003-04-22 16:44         ` tmoran
2003-04-22 17:23           ` Stephen Leake
2003-04-22 21:45             ` Robert A Duff
2003-04-22 22:25               ` tmoran
2003-04-22 23:10                 ` Nick Roberts
2003-04-23  0:24                   ` tmoran [this message]
2003-04-23  8:07                     ` Vinzent Hoefler
2003-04-23 17:18                       ` tmoran
2003-04-23 19:28                         ` Vinzent Hoefler
2003-04-23 11:52                     ` Martin Dowie
2003-04-25 16:06                     ` Nick Roberts
2003-04-25 16:38                       ` Vinzent Hoefler
2003-04-22 22:51           ` Matthew Heaney
2003-04-22 23:16             ` Nick Roberts
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox