From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Does object renaming allow the view to be a copy?
Date: Mon, 23 Jan 2017 14:40:08 -0600
Date: 2017-01-23T14:40:08-06:00 [thread overview]
Message-ID: <o65pn9$7al$1@franka.jacob-sparre.dk> (raw)
In-Reply-To: o61qau$ock$1@dont-email.me
"G.B." <bauhaus@notmyhomepage.invalid> wrote in message
news:o61qau$ock$1@dont-email.me...
>A SO answer (41746244) has given rise to the question of whether
> or not a compiler implementer may make a renamed object a copy
> of the original. (Layman's assumptions from LRM 3.1(7), 8.5.1),
Logically, the item is not a copy. How the compiler implements that,
however, is its business.
> So, is the following program, modifying compoments of and array,
> ever allowed to raise Renaming_Is_Copying?
Of course. The program has nothing to do with copying that I can see.
...
> begin
> if X'Address = Stuff (K)'Address then
The meaning of X'Address is implementation-defined (as someone said,
consider what happens if X is allocated in a register). It's best if its use
is limited to the sort of low-level purposes for which it was defined (that
is, handling memory-mapped hardware). Note in particular 13.3(16): if the
objects in question aren't "aliased", the result of 'Address may not be
"useful".
If the objects are aliased, then you don't need to use 'Address to get the
answer to your question:
if X'Access = Stuff (K)'Access then
would answer your question (but you might need to declare an appropriate
access type somewhere). Note that the compiler would strip off any funny
business for this latter case.
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).
Randy.
next prev parent reply other threads:[~2017-01-23 20:40 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 [this message]
2017-01-24 16:06 ` Robert Eachus
2017-01-24 21:08 ` Randy Brukardt
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox