TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Forum View

Use Monospaced Font
Show Text Part by Default
Condense Mail Headers

Message: [<< First] [< Prev] [Next >] [Last >>]
Topic: [<< First] [< Prev] [Next >] [Last >>]
Author: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
"Team Ada: Ada Advocacy Issues (83 & 95)" <[log in to unmask]>
Tue, 21 May 2002 01:13:40 +0400
"Alexandre E. Kopilovitch" <[log in to unmask]>
"Alexandre E. Kopilovitch" <[log in to unmask]>
text/plain; charset=us-ascii
h w c employees, b f
text/plain (49 lines)
>> If you are using GNAT compiler then you may consider the Code_Address
>> attribute instead of Access (see Implementation Defined Attributes in
>> GNAT Reference Manual).
>Since I don't have access to the Reference Manual:

probably contains it (I'm still using 3.13p - previous version of GNAT).
Anyway, here is full citation from GNAT Reference Manual for GNAT 3.13p :

The 'Address attribute may be applied to subprograms in Ada 95, but the intended
effect from the Ada 95 reference manual seems to be to provide an address value
which can be used to call the subprogram by means of an address clause as in the
following example:

procedure K is ...

procedure L;
for L'Address use K'Address;
pragma Import (Ada, L);

A call to L is then expected to result in a call to K. In Ada 83, where there
were no access-to-subprogram values, this was a common work around for getting
the effect of an indirect call. GNAT implements the above use of Address and
the technique illustrated by the example code works correctly. However, for
some purposes, it is useful to have the address of the start of the generated
code for the subprogram. On some architectures, this is not necessarily the
same as the Address value described above. For example, the Address value may
reference a subprogram descriptor rather than the subprogram itself. The
'Code_Address attribute, which can only be applied to subprogram entities,
always returns the address of the start of the generated code of the specified
subprogram, which may or may not be the same value as is returned by the
corresponding 'Address attribute.

> does 'Code_Address
>meet the two-fold developer expectation, namely: provide the desired
>comparison guarantee, as well as invocation of the subprogram thus

I believe that above definition implies yes, but surely ACT knows better -:)

> If so, could it be standardized? At the very least, it
>is an existence proof that the language limitation -could- be removed.

Perhaps yes.