Tue, 21 May 2002 01:13:40 +0400
h w c employees, b f
>> 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
procedure K is ...
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.