comp.lang.ada
 help / color / mirror / Atom feed
From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Does object renaming allow the view to be a copy?
Date: Tue, 24 Jan 2017 15:08:27 -0600
Date: 2017-01-24T15:08:27-06:00	[thread overview]
Message-ID: <o68fob$js6$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: 1554966b-2882-4f1f-8cc8-be5a03e44ad0@googlegroups.com


"Robert Eachus" <rieachus@comcast.net> wrote in message 
news:1554966b-2882-4f1f-8cc8-be5a03e44ad0@googlegroups.com...
> On Monday, January 23, 2017 at 3:40:10 PM UTC-5, Randy Brukardt wrote:
>
>> IMHO, 'Address should only appear in a program that is interfacing to 
>> some
>> memory-mapped entity; else use some form of 'Access (or 
>> 'Unchecked_Access).
>
> Hmm.  My code has cases of:
>      for X'Address use at mod 4;

Looks like you are trying to set Alignment which Ada 83 didn't have. Set 
alignment directly, so your reader knows what you're doing.

> I've also broken abstractions by using 'Address to obtain access to the 
> details
> of an otherwise private type--those are old, and can be updated to use 
> child packages.

Correct.

> I also seem to recall that a lot of the NUMWG work uses address clauses 
> when pulling
> floating point numbers apart--and putting them back together.

Ada 95 says that Unchecked_Conversion can be by-reference, so the 
performance reason for not using UC in this case doesn't exist (assuming a 
friendly implementer). UC also doesn't force a compiler to abandon many 
useful optimizations (or do horrible analysis before allowing it).

> and I also have some mixed Fortran and Ada that uses at Foo'Address + 24 
> or the like to deal with
> Fortran common blocks that are really overlays. (For example, one 
> declaration has the common block
>                     as an array, another converts it to a vector.)

This falls under "interfacing to some memory-mapped entity"; I purposely 
didn't say "hardware" because sometimes software needs it too.

> Are all of these deprecated now?

All but the last can be done better with other constructs, IMHO. For the 
last, it's case-by-case what the best approach would be: you might need 
'Address.

                       Randy. 



      reply	other threads:[~2017-01-24 21:08 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-22  8:27 Does object renaming allow the view to be a copy? G.B.
2017-01-22 10:37 ` Simon Wright
2017-01-22 16:26 ` AdaMagica
2017-01-22 17:37   ` Simon Wright
2017-01-22 20:24     ` Dmitry A. Kazakov
2017-01-23 10:49       ` AdaMagica
2017-01-23 11:06         ` Dmitry A. Kazakov
2017-01-23 20:40 ` Randy Brukardt
2017-01-24 16:06   ` Robert Eachus
2017-01-24 21:08     ` Randy Brukardt [this message]
replies disabled

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