Re: Address of a fortran variable



David Flower wrote:
......
Many compilers support LOC, where LOC(X) returns the address of X. It
is not standard, despite having been around in FORTRAN for a very long
time.
......

True, and of those, several F77's &c. also had ALOC(X), usually a second
name for the same entry point in an (external) assembly-coded library
routine to avoid a few 'problems' with assumed data type. The one I was
very familiar with, the code (the same entry point and instructions for
both LOC and ALOC) loaded the address of the X into both the register
where INTEGER and LOGICAL results were returned and into another
register where REAL, dp and part of COMPLEX & dp COMPLEX results were
returned, so that no matter what data types were specified for LOC and
ALOC, reasonable results were returned.

Ah, history! ATB,

John.
.



Relevant Pages