* Predefined Language Attributes 'ADDRESS and 'ACCESS
@ 2018-12-06 6:25 ldries46
2018-12-06 9:56 ` Dmitry A. Kazakov
2018-12-06 16:43 ` Jeffrey R. Carter
0 siblings, 2 replies; 3+ messages in thread
From: ldries46 @ 2018-12-06 6:25 UTC (permalink / raw)
What is the principal difference between the Attributes 'ADDRESS and
'ACCESS? When do you use them?
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Predefined Language Attributes 'ADDRESS and 'ACCESS
2018-12-06 6:25 Predefined Language Attributes 'ADDRESS and 'ACCESS ldries46
@ 2018-12-06 9:56 ` Dmitry A. Kazakov
2018-12-06 16:43 ` Jeffrey R. Carter
1 sibling, 0 replies; 3+ messages in thread
From: Dmitry A. Kazakov @ 2018-12-06 9:56 UTC (permalink / raw)
On 2018-12-06 07:25, ldries46 wrote:
> What is the principal difference between the Attributes 'ADDRESS and
> 'ACCESS? When do you use them?
1. Access is portable, Address is not. However across machines with flat
memory Address might be as good as portable.
2. Access is strongly typed, Address is untyped. Furthermore access
supports dispatching and class-wide calls as expected.
3. Access is memory pool aware, Address is blind to whatever memory
management policy.
4. Access could work around some machine limitations address cannot.
E.g. access could, theoretically, refer to things that do not have
physical address, like packed data, data outside conventional memory etc.
5. Access is a subject of accessibility checks and other constraints,
e.g. "not null". Not everybody sees all these as an advantage, but in
some cases it might help to generate safer and more efficient code.
--
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Predefined Language Attributes 'ADDRESS and 'ACCESS
2018-12-06 6:25 Predefined Language Attributes 'ADDRESS and 'ACCESS ldries46
2018-12-06 9:56 ` Dmitry A. Kazakov
@ 2018-12-06 16:43 ` Jeffrey R. Carter
1 sibling, 0 replies; 3+ messages in thread
From: Jeffrey R. Carter @ 2018-12-06 16:43 UTC (permalink / raw)
On 12/6/18 7:25 AM, ldries46 wrote:
> What is the principal difference between the Attributes 'ADDRESS and 'ACCESS?
> When do you use them?
The principal difference is that 'Address returns a value of type System.Address
and 'Access returns a value of an access type. They are not the same and there
is not necessarily any relationship between them.
From ARM K.2(2-7) Language-Defined Attributes:
2
P'Access
For a prefix P that denotes a subprogram:
3
P'Access yields an access value that designates the subprogram denoted by P. The
type of P'Access is an access-to-subprogram type (S), as determined by the
expected type. See 3.10.2.
4
X'Access
For a prefix X that denotes an aliased view of an object:
5
X'Access yields an access value that designates the object denoted by X. The
type of X'Access is an access-to-object type, as determined by the expected
type. The expected type shall be a general access type. See 3.10.2.
6/1
X'Address
For a prefix X that denotes an object, program unit, or label:
7
Denotes the address of the first of the storage elements allocated to X. For a
program unit or label, this value refers to the machine code associated with the
corresponding body or statement. The value of this attribute is of type
System.Address. See 13.3.
http://www.ada-auth.org/standards/rm12_w_tc1/html/RM-K-2.html
--
Jeff Carter
"Why, the Mayflower was full of Fireflies, and a few
horseflies, too. The Fireflies were on the upper deck,
and the horseflies were on the Fireflies."
Duck Soup
95
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-12-06 16:43 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-06 6:25 Predefined Language Attributes 'ADDRESS and 'ACCESS ldries46
2018-12-06 9:56 ` Dmitry A. Kazakov
2018-12-06 16:43 ` Jeffrey R. Carter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox